/* ==========================================================================
   Kefy Studio — design system
   Every value below is a token. Nothing in the markup invents its own.
   Documented on the Foundations artboard of the design canvas.
   ========================================================================== */

:root {
  /* ---- ink: solid values, never alpha stacked on the background ---------- */
  --ink:        #2A1E17;   /* primary    14.6:1 on canvas */
  --ink-2:      #5E5047;   /* secondary   7.2:1 */
  --ink-3:      #7B6C60;   /* meta        4.7:1 */
  --ink-4:      #A0917F;   /* placeholder only, never body copy */

  /* ---- surface ---------------------------------------------------------- */
  --canvas:     #FAF6EE;
  --canvas-top: #FDFAF4;   /* hero wash */
  --raised:     #F3ECE0;
  --card:       #FFFDF9;

  /* ---- line ------------------------------------------------------------- */
  --line:       #E7DDCD;
  --line-2:     #D6C9B6;

  /* ---- accent: terracotta acts, sage confirms. Nothing else is coloured -- */
  --accent:     #B24E19;
  --accent-2:   #8F3D12;
  --accent-line:#E3C9B4;
  --sage:       #5E7050;
  --sage-ink:   #4E5F42;
  --sage-wash:  #EDF0E8;
  --sage-line:  #DCE2D4;

  /* ---- on the espresso footer ------------------------------------------- */
  --dark-ink:   #EFE7DA;
  --dark-ink-2: #B3A695;
  --dark-ink-3: #8A7B6C;
  --dark-line:  #3F3128;

  /* ---- status ----------------------------------------------------------- */
  --warn-wash:  #F7E6DA;
  --warn-line:  #EBD2C0;
  --danger:     #A3321C;

  /* ---- space: 4px base -------------------------------------------------- */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;
  --s7: 32px; --s8: 40px; --s9: 48px; --s10: 64px; --s11: 80px; --s12: 96px;
  --section: clamp(56px, 7vw, 96px);
  --gutter:  clamp(20px, 4vw, 40px);

  /* ---- radius ----------------------------------------------------------- */
  --r-sm: 6px; --r: 10px; --r-md: 14px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;

  /* ---- elevation: warm-tinted, never neutral grey ----------------------- */
  --e-raised: 0 1px 2px rgba(42,30,23,.05);
  --e-card:   0 1px 2px rgba(42,30,23,.05), 0 10px 28px -16px rgba(42,30,23,.22);
  --e-float:  0 4px 8px rgba(42,30,23,.05), 0 24px 56px -14px rgba(42,30,23,.26);
  --e-btn:    0 2px 4px rgba(42,30,23,.06), 0 10px 24px -8px rgba(42,30,23,.28);

  /* ---- motion: one duration, one curve, everywhere ---------------------- */
  --t: .16s cubic-bezier(.2,.6,.2,1);
  --t-slow: .2s cubic-bezier(.2,.6,.2,1);

  /* ---- type ------------------------------------------------------------- */
  --display: Newsreader, Georgia, 'Times New Roman', serif;
  --text: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent); }

button, input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--ink-4); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

img, svg { max-width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   Type scale — nine steps. Nothing is sized outside this list.
   ========================================================================== */
.d1 { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 5vw, 66px); line-height: 1.02; letter-spacing: -.028em; }
.d2 { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.08; letter-spacing: -.022em; }
.d3 { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.18; letter-spacing: -.016em; }
.d4 { font-family: var(--display); font-weight: 500; font-size: 20px; line-height: 1.25; letter-spacing: -.012em; }
.lead { font-size: clamp(17px, 1.5vw, 19px); line-height: 1.55; color: var(--ink-2); }
.body { font-size: 16px; line-height: 1.6; }
.sm { font-size: 15px; line-height: 1.55; }
.cap { font-size: 13px; line-height: 1.45; color: var(--ink-3); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }

.serif { font-family: var(--display); }
.italic { font-family: var(--display); font-style: italic; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.meta { color: var(--ink-3); }
.pretty { text-wrap: pretty; }
.balance { text-wrap: balance; }
.tnum { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Layout
   ========================================================================== */
.wrap { max-width: 1200px; margin: 0 auto; padding-inline: var(--gutter); }
.sect { padding-block: var(--section); }
.sect--line { border-top: 1px solid var(--line); }
.sect--raised { background: var(--raised); border-block: 1px solid var(--line); }
.sect--wash { background: linear-gradient(180deg, var(--canvas-top) 0%, var(--canvas) 64%); }

.g12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(32px, 4vw, 56px); }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s7); }
.g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 4vw, 56px); }
.span7 { grid-column: span 7; } .span6 { grid-column: span 6; }
.span5 { grid-column: span 5; } .span4 { grid-column: span 4; } .span3 { grid-column: span 3; }
.start { align-items: start; } .center { align-items: center; } .end { align-items: end; }

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.wrapflex { flex-wrap: wrap; }
.gap2 { gap: var(--s2); } .gap3 { gap: var(--s3); } .gap4 { gap: var(--s4); }
.gap5 { gap: var(--s5); } .gap6 { gap: var(--s6); } .gap7 { gap: var(--s7); }
.push { margin-left: auto; }

/* ==========================================================================
   Header
   ========================================================================== */
.hdr-bar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250, 246, 238, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.hdr { display: flex; align-items: center; gap: var(--s7); min-height: 68px; }
.brand { display: flex; align-items: center; gap: var(--s3); flex: none; }
.brand-name { font-family: var(--display); font-size: 24px; font-weight: 500; letter-spacing: -.015em; line-height: 1; }
.navlinks { display: flex; align-items: center; gap: 28px; margin-left: auto; font-size: 15px; }
.navlinks a, .navlinks button { color: var(--ink-2); }
.navlinks button { border: none; background: none; padding: 0; font-size: 15px; cursor: pointer; transition: color var(--t); }
.navlinks a:hover, .navlinks button:hover { color: var(--accent); }
.navcta { flex: none; }
.hdr-user { display: flex; align-items: center; gap: var(--s5); margin-left: auto; font-size: 13px; }
.hdr-email { color: var(--ink-3); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  border: none; border-radius: var(--r); cursor: pointer;
  padding: 15px 26px; font-size: 16px; font-weight: 500; min-height: 48px;
  transition: background-color var(--t), border-color var(--t), transform var(--t), opacity var(--t);
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn--sm { padding: 10px 18px; font-size: 15px; min-height: 40px; }
.btn--full { width: 100%; }
.btn--primary { background: var(--accent); color: var(--card); box-shadow: var(--e-btn); }
.btn--primary:hover { background: var(--accent-2); }
.btn--dark { background: var(--ink); color: var(--canvas); }
.btn--dark:hover { background: var(--accent); }
.btn--ghost { background: var(--card); border: 1px solid var(--line-2); color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent); background: var(--raised); }
.btn--quiet { background: none; border: none; color: var(--ink-2); padding: 0; min-height: 0; font-size: 15px; }
.btn--quiet:hover { color: var(--accent); transform: none; }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--e-card);
}
.card--pad { padding: clamp(24px, 3vw, 32px); }
.card--flush { overflow: hidden; }
.card--lift { transition: box-shadow var(--t-slow), transform var(--t-slow); }
.card--lift:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(42,30,23,.05), 0 20px 44px -10px rgba(42,30,23,.18); }

/* browser chrome on site mockups */
.chrome {
  display: flex; align-items: center; gap: var(--s2);
  padding: 10px 14px; background: var(--raised); border-bottom: 1px solid var(--line);
}
.chrome-dot { width: 7px; height: 7px; border-radius: var(--r-pill); background: var(--line-2); flex: none; }
.chrome-url { font-family: var(--mono); font-size: 12px; color: var(--ink-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.shot { aspect-ratio: 16 / 9; overflow: hidden; }
.shot svg { display: block; width: 100%; height: 100%; }

/* ==========================================================================
   Pills, badges
   ========================================================================== */
.pill {
  display: inline-flex; align-items: center; gap: var(--s2);
  border-radius: var(--r-pill); padding: 7px 14px;
  font-size: 13px; font-weight: 500;
  background: var(--sage-wash); color: var(--sage-ink); border: 1px solid var(--sage-line);
}
.dot { width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--sage); flex: none; }
.pill--eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.badge {
  display: inline-flex; align-items: center; border-radius: var(--r-pill);
  padding: 4px 11px; font-size: 12px; font-weight: 600; letter-spacing: .04em;
}
.badge--submitted  { background: var(--sage-wash); color: #415036; border: 1px solid var(--sage-line); }
.badge--progress   { background: var(--warn-wash); color: var(--accent-2); border: 1px solid var(--warn-line); }
.badge--done       { background: var(--raised);    color: var(--ink-3);   border: 1px solid var(--line); }

.tag { border-radius: var(--r-pill); padding: 3px 10px; font-size: 12px; background: var(--raised); color: var(--ink-3); }
.tag--accent { background: var(--accent); color: var(--card); }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: grid; gap: var(--s2); }
.field > span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--canvas); font-size: 16px; min-height: 48px;
  transition: border-color var(--t), background-color var(--t);
}
.textarea { line-height: 1.6; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); background: var(--card); outline: none; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.file {
  width: 100%; font-size: 15px; color: var(--ink-2); padding: 12px 14px;
  border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--canvas); min-height: 48px;
}
.field-note { font-size: 13px; color: var(--ink-3); }
.field-error { font-size: 13px; color: var(--danger); }

/* form-level message */
.notice {
  border-radius: var(--r-md); padding: 14px 16px; font-size: 15px; line-height: 1.5;
  border: 1px solid var(--line); background: var(--raised); color: var(--ink-2);
}
.notice--error { background: var(--warn-wash); border-color: var(--warn-line); color: var(--accent-2); }
.notice--ok    { background: var(--sage-wash); border-color: var(--sage-line); color: var(--sage-ink); }

/* ==========================================================================
   Lists / rows
   ========================================================================== */
.rows { display: flex; flex-direction: column; }
.rows > * { border-bottom: 1px solid var(--line); }
.rows > *:last-child { border-bottom: 0; }
.datarow { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: space-between; padding: 16px 22px; font-size: 16px; }
.linkrow { display: block; padding: 20px 22px; }

.steps { list-style: none; margin: 0; padding: 0; }
.step { border-top: 2px solid var(--ink); padding-top: var(--s6); }
.step-n { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--accent); }
.step-rule { flex: 1; height: 1px; background: var(--line-2); }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { background: var(--ink); color: var(--dark-ink); }
.footer a { color: var(--dark-ink); }
.footer a:hover { color: #E8C98E; }
.footer .eyebrow { color: var(--dark-ink-3); }
.footer-note { margin: clamp(36px, 5vw, 56px) 0 0; padding-top: var(--s5); border-top: 1px solid var(--dark-line); font-size: 13px; color: var(--dark-ink-3); }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--canvas);
  padding: 14px 22px; border-radius: var(--r-pill); font-size: 15px;
  max-width: calc(100vw - 32px); text-align: center;
  box-shadow: 0 8px 28px -6px rgba(42,30,23,.5);
  animation: rise .2s cubic-bezier(.2,.6,.2,1) both;
}

@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: riseIn .3s cubic-bezier(.2,.6,.2,1) both; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .6s linear infinite;
}

/* ==========================================================================
   Auth states — the page renders signed-out by default so a failed script
   can never flash private content.
   ========================================================================== */
[data-auth="out"] .when-in { display: none; }
[data-auth="in"]  .when-out { display: none; }
[hidden] { display: none !important; }

.gate { min-height: 60vh; display: grid; place-items: center; text-align: center; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1000px) {
  .span7, .span6, .span5 { grid-column: span 12; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span4, .span3 { grid-column: span 6; }
}
@media (max-width: 680px) {
  .g3, .g2 { grid-template-columns: minmax(0, 1fr); }
  .span4, .span3 { grid-column: span 12; }
  /* logo and the one primary action stay on the top row; links wrap below */
  .hdr { flex-wrap: wrap; gap: 12px 20px; padding-block: 12px; }
  .navlinks { order: 3; width: 100%; margin-left: 0; gap: 18px; padding-bottom: 4px; }
  .navcta { margin-left: auto; }
  .datarow, .linkrow { padding-inline: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .btn:hover, .card--lift:hover { transform: none; }
}
