/* ClearJD ---------------------------------------------------------------
   Tokens first, then layout, then components.
   No build step: this file is loaded directly by index.html.
   ---------------------------------------------------------------------- */

:root{
  /* Colour. Tokens are named for their role, not their hue, so a value can
     change without the name becoming a lie. */
  --bg:#0E141B;
  --surface:#161E27;
  --surface-2:#1D2733;
  --text:#F3F1EA;
  --text-dim:#8F9AAA;
  --text-faint:#5B6472;
  --accent:#FFD400;
  --accent-ink:#0E141B;
  --accent-soft:rgba(255,212,0,0.16);
  --marker:#33D6B8;
  --danger:#FF8A6B;
  --border:rgba(243,241,234,0.10);

  /* Type */
  --mono:'IBM Plex Mono', ui-monospace, monospace;
  --display:'Space Grotesk', system-ui, sans-serif;
  --body:'Inter', system-ui, sans-serif;

  /* Shape */
  --radius:12px;
  --radius-sm:8px;

  /* Rhythm */
  --gutter:24px;
  --col-gap:40px;
  --page-max:1180px;
}

*{box-sizing:border-box;}
[hidden]{display:none !important;}
html{scroll-behavior:smooth;}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--body);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

a{color:inherit;}

/* Form controls default to the browser's font, not the page's. */
input, select, textarea, button{font:inherit; color:inherit;}

/* One consistent keyboard focus ring for every interactive element. */
:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}

/* Visible to screen readers only. */
.sr-only{
  position:absolute;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;
  clip-path:inset(50%);
  white-space:nowrap;
  border:0;
}

.wrap{max-width:var(--page-max); margin:0 auto; padding:0 var(--gutter);}


/* Header ---------------------------------------------------------------- */

header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:22px 0;
  border-bottom:1px solid var(--border);
}
.logo{
  font-family:var(--display);
  font-weight:700;
  font-size:20px;
  letter-spacing:-0.01em;
  display:flex;
  align-items:center;
  gap:2px;
}
.logo .mark{
  background:var(--accent);
  color:var(--accent-ink);
  padding:0 6px;
  border-radius:3px;
  transform:rotate(-2deg);
  display:inline-block;
}

.lang-toggle{
  display:flex;
  gap:4px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:999px;
  padding:4px;
}
.lang-toggle button{
  font-family:var(--mono);
  font-size:12px;
  letter-spacing:0.04em;
  text-transform:uppercase;
  background:transparent;
  color:var(--text-dim);
  border:none;
  padding:6px 14px;
  border-radius:999px;
  cursor:pointer;
  transition:background .15s ease, color .15s ease;
}
.lang-toggle button[aria-pressed="true"]{
  background:var(--accent);
  color:var(--accent-ink);
  font-weight:500;
}


/* Hero ------------------------------------------------------------------ */

.hero{
  padding:64px 0 40px;
  border-bottom:1px solid var(--border);
}
.eyebrow{
  font-family:var(--mono);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:0.14em;
  color:var(--marker);
  margin:0 0 18px;
}
h1{
  font-family:var(--display);
  font-weight:700;
  font-size:clamp(34px, 5.4vw, 58px);
  line-height:1.16;
  letter-spacing:-0.02em;
  text-wrap:balance;
  margin:0 0 20px;
  max-width:17ch;
}
/* Solid highlight behind the whole phrase. A partial-height band would clip
   the letters, since the text itself is painted in the ink colour. */
h1 .hl{
  background:var(--accent);
  color:var(--accent-ink);
  padding:0.02em 0.14em;
  border-radius:3px;
  box-decoration-break:clone;
  -webkit-box-decoration-break:clone;
}
.sub{
  font-size:18px;
  color:var(--text-dim);
  max-width:56ch;
  margin:0;
}


/* Worked examples ------------------------------------------------------- */

.examples{margin-top:32px;}
.examples-hint{
  font-family:var(--mono);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:0.1em;
  color:var(--text-dim);
  margin:0 0 12px;
}
.example-row{display:flex; gap:10px; flex-wrap:wrap;}
.example-chip{
  display:flex;
  flex-direction:column;
  gap:2px;
  text-align:left;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:10px 16px;
  cursor:pointer;
  transition:border-color .15s ease, background .15s ease;
}
.example-chip:hover{border-color:var(--accent); background:var(--surface-2);}
.example-label{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:14px;
  font-weight:600;
  color:var(--text);
}
/* Loading an example switches the interface to the language it was written
   in, so say which that is before it happens. */
.example-lang{
  font-family:var(--mono);
  font-size:10px;
  font-weight:500;
  text-transform:uppercase;
  letter-spacing:0.08em;
  color:var(--text-dim);
  border:1px solid var(--border);
  border-radius:3px;
  padding:1px 5px;
}
.example-note{font-size:12px; color:var(--text-dim);}


/* Builder layout -------------------------------------------------------- */

.builder{
  display:grid;
  grid-template-columns:1fr 1fr;
  border-bottom:1px solid var(--border);
}
.col{padding:40px 0;}
.col-form{border-right:1px solid var(--border); padding-right:var(--col-gap);}
.col-preview{padding-left:var(--col-gap);}

.section-label{
  font-family:var(--mono);
  font-size:12px;
  font-weight:500;
  text-transform:uppercase;
  letter-spacing:0.12em;
  color:var(--text-dim);
  margin:28px 0 14px;
  display:flex;
  align-items:center;
  gap:10px;
}
.section-label:first-child{margin-top:0;}
.section-label::after{
  content:'';
  flex:1;
  height:1px;
  background:var(--border);
}


/* Form controls --------------------------------------------------------- */

.field{margin-bottom:16px;}
.field label,
.group-label{
  display:block;
  font-size:13px;
  font-weight:500;
  color:var(--text);
  margin-bottom:6px;
}
.field .hint{
  display:block;
  font-size:12px;
  color:var(--text-dim);
  margin-top:6px;
}
.field .hint.warn{color:var(--danger);}
.hint.standalone{
  display:block;
  font-size:12px;
  color:var(--text-dim);
  margin:0 0 16px;
  max-width:60ch;
}
.row3{display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px;}

/* A number paired with the unit it is measured in, so "2" is never ambiguous. */
.inline-pair{display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
.inline-pair input{width:90px; flex:0 0 auto;}
.unit-suffix{font-size:13px; color:var(--text-dim); white-space:nowrap;}

/* One row per interview stage, built to match the number the user entered. */
.stage-list{display:flex; flex-direction:column; gap:8px; margin-top:10px;}
.stage-row{display:flex; align-items:center; gap:8px;}
.stage-badge{
  flex:0 0 auto;
  width:26px; height:26px;
  display:grid; place-items:center;
  font-family:var(--mono);
  font-size:12px;
  color:var(--accent);
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:50%;
}
.stage-row .stage-what{flex:1 1 auto; min-width:0;}
.stage-row .stage-minutes{flex:0 0 76px; width:76px;}

input[type=text],
input[type=number],
select,
textarea{
  width:100%;
  background:var(--surface);
  border:1px solid var(--border);
  color:var(--text);
  font-family:var(--body);
  font-size:14px;
  padding:10px 12px;
  border-radius:var(--radius-sm);
  transition:border-color .15s ease, background .15s ease;
}
input.narrow{max-width:110px;}
input::placeholder, textarea::placeholder{color:var(--text-faint);}
input:focus, select:focus, textarea:focus{
  border-color:var(--accent);
  background:var(--surface-2);
}

/* A native <select> keeps the whole list browsable after a choice is made,
   which a filtering datalist does not. Styled so the closed control matches
   the page instead of falling back to the browser default. */
select{
  appearance:none;
  cursor:pointer;
  padding-right:34px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238F9AAA'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 12px center;
}
/* The open dropdown is drawn by the OS, so give it readable colours too. */
select option{background:var(--surface); color:var(--text);}
input[aria-invalid="true"]{border-color:var(--danger);}
textarea{resize:vertical; min-height:64px;}

.radio-row{display:flex; gap:8px; flex-wrap:wrap;}
.radio-row button{
  font-size:13px;
  background:var(--surface);
  border:1px solid var(--border);
  color:var(--text-dim);
  padding:8px 14px;
  border-radius:var(--radius-sm);
  cursor:pointer;
  transition:border-color .15s ease, background .15s ease;
}
.radio-row button[aria-pressed="true"]{
  border-color:var(--accent);
  color:var(--text);
  background:var(--surface-2);
}
.radio-row button[aria-pressed="true"]::before{content:'✓ '; color:var(--accent);}


/* Preview --------------------------------------------------------------- */

.preview-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:28px 30px;
  position:sticky;
  top:24px;
}
.preview-title{
  font-family:var(--mono);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:0.1em;
  color:var(--text-dim);
  margin:0 0 18px;
}
.doc{
  font-family:var(--mono);
  font-size:13px;
  line-height:1.75;
  word-break:break-word;
}
.doc h2{
  font-family:var(--display);
  font-size:22px;
  margin:0 0 4px;
  color:var(--text);
}
.doc h3{
  font-family:var(--mono);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:0.1em;
  color:var(--marker);
  margin:22px 0 10px;
  border-top:1px solid var(--border);
  padding-top:16px;
}
.doc h3:first-of-type{border-top:none; padding-top:0;}
.doc p{margin:0 0 8px;}
.doc .k{color:var(--text-dim);}
.doc .v{
  background:var(--accent-soft);
  color:var(--text);
  padding:1px 4px;
  border-radius:3px;
  box-decoration-break:clone;
  -webkit-box-decoration-break:clone;
  white-space:pre-wrap;
}
.doc .empty{color:var(--text-faint); font-style:italic;}
.doc .bullet{color:var(--text-faint);}

.actions{display:flex; gap:10px; margin-top:22px;}
.btn{
  font-weight:600;
  font-size:14px;
  padding:11px 18px;
  border-radius:var(--radius-sm);
  border:1px solid transparent;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
  transition:filter .15s ease, border-color .15s ease;
}
.btn-primary{background:var(--accent); color:var(--accent-ink);}
.btn-primary:hover{filter:brightness(1.06);}
.btn-ghost{background:transparent; border-color:var(--border); color:var(--text);}
.btn-ghost:hover{border-color:var(--text-dim);}
.btn.copied{background:var(--marker); color:var(--accent-ink);}


/* Contribute band ------------------------------------------------------- */

.contribute{
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:16px;
  padding:26px 28px;
  margin:32px 0;
  background:var(--surface);
  border:1px solid var(--border);
  border-left:3px solid var(--accent);
  border-radius:var(--radius);
}
.contribute p{margin:0; color:var(--text-dim); font-size:15px; max-width:64ch;}
.contribute strong{color:var(--text); font-weight:600;}
.contribute .btn-ghost{white-space:nowrap; text-decoration:none;}


/* Footer ---------------------------------------------------------------- */

footer{
  padding:8px 0 60px;
  color:var(--text-dim);
  font-size:13px;
  display:flex;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:12px;
}
footer a{color:var(--marker); text-decoration:none;}
footer a:hover{text-decoration:underline;}


/* Narrow screens -------------------------------------------------------- */

@media (max-width: 860px){
  .builder{grid-template-columns:1fr;}
  .col-form{
    border-right:none;
    border-bottom:1px solid var(--border);
    padding-right:0;
  }
  .col-preview{padding-left:0;}
  .preview-card{position:static;}
  .row3{grid-template-columns:1fr 1fr;}
}


/* Accessibility preferences --------------------------------------------- */

@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto;}
  *,*::before,*::after{
    animation-duration:0.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:0.01ms !important;
  }
}

@media (prefers-contrast: more){
  :root{--border:currentColor; --text-dim:var(--text);}
}
