/* ==========================================================================
   Silverhue — a color darkroom
   Token system
   ========================================================================== */
:root {
  --bg:        #171310;
  --panel:     #221C17;
  --panel-2:   #2A2219;
  --paper:     #F3ECDD;
  --ink:       #F2EEE6;
  --muted:     #B8AFA0;
  --safelight: #E23D28;
  --safelight-dim: #8C2A1D;
  --brass:     #C89B5C;
  --fixer:     #5B8C5A;
  --line:      rgba(243, 236, 221, 0.12);
  --line-strong: rgba(243, 236, 221, 0.22);
  --shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.6);

  --font-display: 'Newsreader', Georgia, serif;
  --font-body:    'Karla', -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  --radius: 3px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* faint film-grain texture across the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 2;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--paper);
}

h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); font-weight: 600; }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

/* ambient safelight glow, fixed top-right, drifts very slowly */
.safelight {
  position: fixed;
  top: -220px;
  right: -160px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 61, 40, 0.20) 0%, rgba(226, 61, 40, 0) 70%);
  z-index: 0;
  pointer-events: none;
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to   { transform: translate(-30px, 40px); }
}

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 3;
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--paper);
  letter-spacing: 0.01em;
}
.brand-mark {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--safelight);
  box-shadow: 0 0 10px 2px rgba(226, 61, 40, 0.65);
  flex-shrink: 0;
}
.nav { display: flex; gap: 28px; }
.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav a:hover, .nav a.on { color: var(--paper); border-color: var(--brass); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { padding: 64px 0 32px; text-align: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  border: 1px solid var(--line-strong);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--fixer);
  box-shadow: 0 0 6px 1px rgba(91, 140, 90, 0.7);
}
.hero h1 { max-width: 700px; margin-left: auto; margin-right: auto; }
.hero h1 em {
  font-style: italic;
  color: var(--safelight);
}
.hero .sub {
  max-width: 560px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 1.04rem;
}

/* ==========================================================================
   Card / tray / drop zone
   ========================================================================== */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  margin: 28px 0;
  box-shadow: var(--shadow);
}

.tray {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  display: block;
  position: relative;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.tray:hover, .tray.drag {
  border-color: var(--safelight);
  background: #2E2117;
}
.tray .ic {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 10px;
}
.tray strong { color: var(--paper); }
.tray .hint {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.tray #fileName {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--brass);
  min-height: 1.2em;
}

/* grain-size radio pills */
.grain-choice {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 4px;
  flex-wrap: wrap;
}
.grain-choice label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.grain-choice input { position: absolute; opacity: 0; pointer-events: none; }
.grain-choice input:checked + span { color: var(--bg); }
.grain-choice label:has(input:checked) {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--bg);
}

.btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  background: var(--safelight);
  color: #FAF3E7;
  border: none;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: #C93C29; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn:focus-visible, a:focus-visible, .tray:focus-visible, .swatch:focus-visible,
.tab:focus-visible, .grain-choice label:focus-within {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--paper);
}
.btn-ghost:hover { background: var(--panel-2); }

.alert {
  margin-top: 16px;
  background: rgba(226, 61, 40, 0.12);
  border: 1px solid rgba(226, 61, 40, 0.4);
  color: #F5C9C1;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.92rem;
}

/* ==========================================================================
   Process steps (Expose / Develop / Fix)
   ========================================================================== */
.process {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 40px 0;
}
.process .step {
  border-top: 2px solid var(--line-strong);
  padding-top: 14px;
}
.process .step .num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--safelight);
  letter-spacing: 0.06em;
}
.process .step h3 { margin: 6px 0 6px; }
.process .step p { color: var(--muted); font-size: 0.92rem; margin: 0; }

/* ==========================================================================
   Result: preview + clothesline of swatches
   ========================================================================== */
.result-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.preview {
  display: block;
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin: 18px 0 8px;
}

.clothesline {
  position: relative;
  margin: 36px 0 20px;
  padding-top: 22px;
}
.clothesline::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0; right: 0;
  height: 1px;
  background: var(--line-strong);
}
.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 16px;
  justify-content: center;
}
.swatch {
  position: relative;
  width: 128px;
  padding: 10px 10px 14px;
  background: var(--paper);
  border-radius: 2px;
  box-shadow: 0 10px 18px -8px rgba(0,0,0,0.55);
  cursor: pointer;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: none;
  font-family: var(--font-body);
}
.swatch:nth-child(2n) { --tilt: 1.4deg; }
.swatch:nth-child(3n) { --tilt: -1.1deg; }
.swatch:nth-child(4n) { --tilt: 0.6deg; }
.swatch:nth-child(5n) { --tilt: -1.7deg; }
.swatch:hover { transform: rotate(0deg) translateY(-3px); box-shadow: 0 16px 24px -8px rgba(0,0,0,0.6); }
.swatch::before {
  /* clothespin */
  content: "";
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 18px;
  background: var(--brass);
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.swatch .chip {
  height: 74px;
  border-radius: 1px;
  margin-bottom: 10px;
}
.swatch .hex {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: #2A2219;
}
.swatch .meta {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: #6B6152;
  margin-top: 3px;
}
.swatch .copied {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(91, 140, 90, 0.92);
  color: #F3ECDD;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  border-radius: 2px;
}
.swatch.done .copied { display: flex; }
.tip { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* ==========================================================================
   Export tabs
   ========================================================================== */
.export-tabs { margin-top: 32px; }
.tab-list { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 0; }
.tab {
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  padding: 9px 14px;
  cursor: pointer;
  border-radius: 3px 3px 0 0;
}
.tab.active { color: var(--paper); background: var(--panel-2); border-color: var(--line); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.code-block {
  background: #12100D;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 3px 3px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: #D9CFBC;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}
.copy-row { display: flex; justify-content: flex-end; margin-top: 8px; }
.copy-row button {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.copy-row button:hover { color: var(--paper); border-color: var(--brass); }

/* ==========================================================================
   Contrast checker
   ========================================================================== */
.contrast-tool { margin-top: 32px; }
.contrast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}
.swatch-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pick {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.pick.sel { border-color: var(--paper); }
.contrast-preview {
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  border: 1px solid var(--line);
}
.contrast-readout {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.contrast-ratio { font-size: 1.3rem; color: var(--paper); }
.pass-pill {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
}
.pass-pill.pass { color: var(--fixer); border-color: var(--fixer); }
.pass-pill.fail { color: var(--safelight); border-color: var(--safelight); }

/* ==========================================================================
   Content sections / blog
   ========================================================================== */
.content { margin: 56px 0; }
.content h2 { margin-top: 1.6em; }
.content a { color: var(--brass); text-decoration: underline; text-decoration-color: rgba(200,155,92,0.4); }
.content a:hover { text-decoration-color: var(--brass); }

.article-header { text-align: center; padding: 56px 0 24px; }
.article-header .date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.article-header h1 { margin-top: 12px; }
.article-body { max-width: 680px; margin: 0 auto; padding-bottom: 40px; }
.article-body h2 { margin-top: 1.7em; }
.article-body p { color: #DDD5C4; }
.back-link {
  display: inline-block;
  margin: 32px 0 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--brass); }

.blog-index { padding: 48px 0; }
.blog-list { list-style: none; padding: 0; margin: 32px 0 0; }
.blog-list li {
  border-top: 1px solid var(--line);
  padding: 22px 0;
}
.blog-list li:last-child { border-bottom: 1px solid var(--line); }
.blog-list a {
  text-decoration: none;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}
.blog-list a:hover { color: var(--safelight); }
.blog-list .date { display: block; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); margin-bottom: 6px; }
.blog-list p { color: var(--muted); margin: 8px 0 0; font-size: 0.94rem; }

/* simple static pages */
.page { padding: 48px 0 60px; max-width: 680px; margin: 0 auto; }
.page h1 { margin-bottom: 0.3em; }
.page .lede { color: var(--muted); margin-bottom: 2em; }
.form-field { margin-bottom: 18px; }
.form-field label { display: block; font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 6px; }
.form-field input, .form-field textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  padding: 11px 13px;
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.form-field textarea { min-height: 130px; resize: vertical; }
.form-field input:focus, .form-field textarea:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
.hp-field { position: absolute; left: -9999px; opacity: 0; }
.notice { background: rgba(91,140,90,0.12); border: 1px solid rgba(91,140,90,0.4); color: #C6E0C4; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 0.92rem; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 40px 0 24px; position: relative; z-index: 2; }
.foot-grid { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot-note { color: var(--muted); font-size: 0.88rem; margin-top: 10px; max-width: 320px; }
.foot-links { display: flex; gap: 20px; flex-wrap: wrap; align-content: flex-start; }
.foot-links a { color: var(--muted); text-decoration: none; font-size: 0.88rem; }
.foot-links a:hover { color: var(--paper); }
.copyright { color: #6B6152; font-size: 0.78rem; margin-top: 28px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
  .nav { gap: 16px; }
  .nav a { font-size: 0.85rem; }
  .process { grid-template-columns: 1fr; }
  .contrast-grid { grid-template-columns: 1fr; }
  .card { padding: 22px; }
  .swatch { width: 110px; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .safelight { animation: none; }
  .swatch, .btn, .tray { transition: none; }
}
