/* ===========================================================
   BASE LAYOUT (mobile-first)
   =========================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #111827;
}

/* ===========================================================
   HEADER + NAVIGATION (mobile-first hamburger)
   =========================================================== */

.site-header {
  background: #111827;
  color: #e5e7eb;
}

/* Header row: brand + hamburger (mobile) */
.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;

  /* Mobile: allow wrapping so menu can appear under this row */
  flex-wrap: wrap;
}

/* Brand title */
.brand a {
  color: #f9fafb;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brand a:hover,
.brand a:focus-visible {
  text-decoration: underline;
  outline: none;
}

/* Hamburger button (mobile only) */
.nav-toggle {
  border: 1px solid #374151;
  background: transparent;
  color: #e5e7eb;
  border-radius: 999px;
  width: 2.3rem;
  height: 2.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.nav-toggle:focus-visible {
  outline: 2px solid #f9fafb;
  outline-offset: 2px;
}

.nav-toggle-box {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle-line {
  width: 1.3rem;
  height: 2px;
  background: #e5e7eb;
  border-radius: 999px;
}

/* Mobile menu panel */
.top-nav {
  display: none;                    /* hidden by default */
  flex-direction: column;
  gap: 0.5rem;

  width: 100%;
  padding: 0 0 0.75rem 0;
  margin-top: 0.35rem;
}

.top-nav a {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
  padding: 0.35rem 1rem;
  border-radius: 999px;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  background: #1f2937;
  outline: none;
}

/* Menu open state */
.top-nav.is-open {
  display: flex;
}

/* Desktop menu layout */
@media (min-width: 768px) {
  .nav-inner {
    padding-block: 0.6rem;
    flex-wrap: nowrap;
  }

  .nav-toggle {
    display: none;                /* hide hamburger */
  }

  .top-nav {
    display: flex !important;     /* always visible */
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;

    margin-top: 0;
    padding: 0;
    width: auto;
    margin-left: auto;            /* push menu to right */
  }
}

/* ===========================================================
   MAIN AREA
   =========================================================== */

main {
  padding: 1rem 1rem 2rem;
  max-width: 100%;
}

@media (min-width: 768px) {
  main {
    max-width: 900px;
    margin: 1.5rem auto 2.5rem;
    padding-inline: 1.5rem;
  }
}

/* ===========================================================
   CARDS (Home page)
   =========================================================== */

.card-grid {
  display: grid;
  grid-template-columns: 1fr;      /* mobile: one column */
  gap: 1rem;
  margin-top: 1.25rem;
}

/* Tablet: 2 columns */
@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Large: 3 columns */
@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  background: #ffffff;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.card p {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.card a.btn {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.85rem;
}

.card a.btn:hover,
.card a.btn:focus-visible {
  filter: brightness(0.97);
  outline: none;
}

/* ===========================================================
   TOOL PANELS (JSON, Base64, URL, Password)
   =========================================================== */

.tool {
  background: #ffffff;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Headings */
h1 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
}

h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

/* Inputs + Textarea */
textarea {
  width: 100%;
  min-height: 160px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  resize: vertical;
  background: #f9fafb;
}

textarea:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
}

input[type="text"] {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  width: 100%;
}

input[type="text"]:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
}

/* Buttons */
.buttons {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

button {
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  background: #2563eb;
  color: white;
  font-size: 0.9rem;
}

button.secondary {
  background: #e5e7eb;
  color: #111827;
}

button:hover {
  filter: brightness(0.97);
}

button:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

/* Output blocks */
pre.output {
  margin-top: 0.5rem;
  padding: 0.6rem;
  background: #0f172a;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas;
  font-size: 0.85rem;
  white-space: pre-wrap;
  border-radius: 6px;
  max-height: 320px;
  overflow: auto;
}

.error {
  color: #b91c1c;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.status {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

/* ===========================================================
   PASSWORD GENERATOR LAYOUT
   =========================================================== */

.pw-lengths {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.pw-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

@media (min-width: 480px) {
  .pw-row {
    flex-direction: row;
    align-items: center;
  }
}

.pw-output {
  flex: 1;
  min-width: 0;
}

/* ===========================================================
   JS OBFUSCATOR – FULL-WIDTH LAYOUT HELPERS
   =========================================================== */

/* Single-column stack layout (textarea full width) */
.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.75rem;
}

/* Section divider inside tool card */
.subtool {
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
  margin-top: 0.25rem;
}

/* Form field grouping */
.field {
  margin-top: 0.75rem;
}

.field label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

/* Checkbox groups */
.checks {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.checks label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
  margin: 0;
}

/* Small helper text */
.hint {
  font-size: 0.85rem;
  color: #374151;
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* Make textarea feel "editor-sized" */
@media (min-width: 768px) {
  textarea {
    min-height: 420px;
  }
}

/* Match selects + number inputs to your tool input style */
select,
input[type="number"] {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  width: 100%;
}

select:focus-visible,
input[type="number"]:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
}

/* Better spacing for option rows */
.field { margin-top: 0.75rem; }
.field label { display: block; font-size: 0.9rem; margin-bottom: 0.35rem; }

/* Checkbox group */
.checks { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.25rem; }
.checks label { display: flex; gap: 0.5rem; align-items: center; margin: 0; }
