/* Philatelic.ai - handwritten stylesheet.
   Design grammar (one owner, one system): warm paper + ink, a print-editorial
   serif for display, one cancellation-red accent used sparingly, hairline rules,
   a single shadow recipe, a perforation motif used once. No gradients, no glow. */

:root {
  --paper:    #f6f2e8;   /* warm stock */
  --card:     #fffdf6;   /* slightly brighter card stock */
  --ink:      #1b1a16;   /* near-black warm ink */
  --muted:    #6b655a;   /* aged-gray text */
  --faint:    #908a7c;
  --line:     #e2dccc;   /* hairline */
  --accent:   #8a2a2b;   /* deep carmine - classic cancellation red */
  --accent-d: #6e2122;

  --serif: "Iowan Old Style","Palatino Linotype",Palatino,"Book Antiqua",Georgia,serif;
  --sans:  -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;

  --measure: 42rem;       /* readable column */
  --wide:    68rem;       /* header/nav rail */
  --shadow: 0 1px 2px rgba(27,26,22,.06), 0 8px 24px rgba(27,26,22,.05); /* the one recipe */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 1.5rem; }
body > .wrap, .site-head .wrap { max-width: var(--wide); }

/* ---- type ---- */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: 0; }
h1 { font-size: 2.6rem; margin: 0 0 .6rem; }
h2 { font-size: 1.6rem; margin: 3rem 0 .8rem; }
h3 { font-size: 1.12rem; margin: 1.6rem 0 .3rem; font-family: var(--sans); font-weight: 650; }
p  { margin: 0 0 1.1rem; }
a  { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-d); }
strong { font-weight: 650; }
.lead { font-size: 1.22rem; color: #2c2a24; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* ---- header ---- */
.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.site-head .wrap { display: flex; align-items: baseline; justify-content: space-between; padding-top: 1.1rem; padding-bottom: 1.1rem; }
.brand { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; color: var(--ink); text-decoration: none; letter-spacing: 0; }
.brand .dot { color: var(--accent); }
.nav a { color: var(--muted); text-decoration: none; font-size: .95rem; margin-left: 1.4rem; }
.nav a:hover { color: var(--ink); }

/* ---- hero ---- */
.hero { padding: 4rem 0 1rem; }
.eyebrow { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 650; margin-bottom: 1rem; }
.cta-row { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1.6rem 0 .4rem; }
.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: .7rem 1.25rem; border-radius: 2px; text-decoration: none; border: 1px solid var(--accent);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); border-color: var(--accent-d); color:#fff; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: rgba(138,42,43,.06); color: var(--accent-d); }

/* ---- example result card (shows the REAL output, not a stock image) ---- */
.specimen {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 3px;
  padding: 1.4rem 1.5rem 1.6rem;
  margin: 2.2rem 0;
  /* perforation motif - the one tasteful skeuomorphic nod, used once */
  position: relative;
}
.specimen::before {
  content: ""; position: absolute; left: 0; right: 0; top: -7px; height: 7px;
  background-image: radial-gradient(circle at 7px 7px, var(--paper) 5px, transparent 5.5px);
  background-size: 14px 14px; background-position: -3px 0;
}
.specimen .cap { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: .9rem; }
.specimen .estimate { font-family: var(--serif); font-size: 1.5rem; margin: 0 0 .1rem; }
.specimen .estimate b { color: var(--accent); }
.specimen .sub { color: var(--muted); font-size: .95rem; margin-bottom: 1.1rem; }

/* Result layout: textual analysis on the left, chart on the right, side by side. */
.result-main { display: flex; gap: 1.5rem; align-items: flex-start; }
.result-text { flex: 1 1 40%; min-width: 0; }
.result-chart { flex: 1 1 60%; min-width: 0; }
@media (max-width: 560px) { .result-main { flex-direction: column; gap: .6rem; } }

/* Vertical column chart. Columns sit on a shared baseline (align-items:flex-end), one per
   grade bucket, low→100 left to right. Bars grow upward; height is % of a fixed track height.
   display:block on track/fill is required — they're <span>s and inline ignores width/height. */
.bars { display: flex; align-items: flex-end; gap: 0; margin-top: .2rem; }
.bar-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.bar-col .pct { height: 1rem; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* No track shade: full-width, gap-free columns glue into one continuous distribution.
   Height is absolute (% of the 120px track = probability %), so charts stay comparable. */
.bar-col .track { display: flex; align-items: flex-end; width: 100%; height: 120px; }
/* Grade-semantic colors: red (low) → amber → green (high), with blue for Gem 100. The
   predicted (argmax) bar is full-opacity; the rest are muted so the prediction stands out. */
/* Grade colors live as one --gc variable per bucket, set on any [data-b] element, so both
   the bar fills AND the grade headline pull the same color. */
[data-b="low"] { --gc: #b23b2e; }
[data-b="70"]  { --gc: #c75d33; }
[data-b="75"]  { --gc: #d07f33; }
[data-b="80"]  { --gc: #cf9a37; }
[data-b="85"]  { --gc: #c2ad3f; }
[data-b="90"]  { --gc: #95ad45; }
[data-b="95"]  { --gc: #5d9f4e; }
[data-b="98"]  { --gc: #3c8f57; }
[data-b="100"] { --gc: #2f73a8; }
.bar-col .fill { display: block; width: 100%; opacity: .5; background: var(--gc, #9aa0a6); }
.bar-col .g { margin-top: .35rem; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-col.strong .fill { opacity: 1; }
.bar-col.strong .pct, .bar-col.strong .g { color: var(--ink); font-weight: 600; }

/* Grade headline (left column): big colored number + established quality ranking, colored to
   match its grade bar. "J" appended when the model calls it a Jumbo. */
.grade-headline { display: flex; align-items: baseline; flex-wrap: wrap; gap: .15rem .55rem; margin: .1rem 0 .25rem; color: var(--gc, var(--ink)); }
.grade-num { font-size: 2.5rem; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.grade-num .grade-j { font-weight: 800; margin-left: .04em; }
.grade-rank { font-size: 1.1rem; font-weight: 650; }

.flagline { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .88rem; color: var(--muted); }

/* ---- plain content ---- */
section { padding: .4rem 0; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }
ul.clean { list-style: none; padding: 0; margin: 0 0 1.1rem; }
ul.clean li { padding: .15rem 0 .15rem 1.3rem; position: relative; }
ul.clean li::before { content: "-"; position: absolute; left: 0; color: var(--faint); }
.section-rule { border-top: 1px solid var(--line); padding-top: .9rem; }
h2.section-rule { margin-top: 1.2rem; }
p.section-rule, ul.section-rule { margin-top: 1.2rem; }
.section-title { border-bottom: 1px solid var(--line); padding-bottom: .45rem; }
.rule-block { margin-top: 1.2rem; }
.rule-block h2 { margin-top: 0; }
.roadmap-list { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .2rem; }
.feedback-cta {
  border-top: 1px solid var(--line);
  padding-top: .9rem;
  margin-top: 1.4rem;
}
.feedback-cta h2 { margin-top: 0; }
.feedback-cta .btn { margin-top: .2rem; }

.quick-benefits {
  list-style: none; padding: 0; margin: .5rem 0 1.4rem;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.quick-benefits li { padding: .65rem 0 .65rem 1.2rem; position: relative; font-size: 1rem; }
.quick-benefits li + li { border-top: 1px solid var(--line); }
.quick-benefits li::before { content: "-"; position: absolute; left: 0; color: var(--accent); }

.use-cases, .value { margin-top: 2.4rem; }
.use-cases h2, .value h2 { margin-top: 0; }
.use-grid > div p { margin: .15rem 0 0; color: var(--muted); font-size: .95rem; }

.pipeline-steps { list-style: none; padding: 0; margin: .9rem 0 1.6rem; }
.pipeline-steps li {
  display: grid;
  grid-template-columns: 1.7rem 1fr;
  gap: .75rem;
  align-items: start;
  padding: .45rem 0;
  border-top: 1px solid var(--line);
}
.pipeline-steps span {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 700;
}
.pipeline-steps p { margin: 0; }

/* 3-step flow under the hero */
.steps { list-style: none; padding: 0; margin: 1.3rem 0 2rem; display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 680px){ .steps { grid-template-columns: repeat(3, 1fr); gap: 1.4rem; } }
.steps li { display: flex; gap: .7rem; align-items: flex-start; }
.step-n {
  flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
}
.steps h3 { margin: .1rem 0 .15rem; font-size: 1.02rem; }
.steps p { margin: 0; font-size: .92rem; color: var(--muted); }
.use-grid { display: grid; grid-template-columns: 1fr; gap: .8rem; }
.use-grid > div { border-top: 1px solid var(--line); padding-top: .8rem; }
.use-grid h3 { margin-top: 0; }
.next-steps {
  margin-top: 2.2rem; padding-top: 1rem; border-top: 1px solid var(--line);
}
.next-steps h2 { margin-top: 0; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem 2.2rem; }
.cols h3 { margin-top: 0; }

/* Stacked points (one per row), e.g. Accuracy & limits → "Where it struggles" */
.stack-list { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1rem 0; }
.stack-list > div { border-top: 1px solid var(--line); padding-top: .8rem; }
.stack-list h3 { margin: 0 0 .25rem; }
.stack-list p { margin: 0; color: var(--muted); }
@media (min-width: 760px){ .use-grid { grid-template-columns: 1fr 1fr 1fr; gap: 1.3rem; } }
@media (max-width: 640px){ .cols { grid-template-columns: 1fr; } h1 { font-size: 2.1rem; } }

/* ---- static how-it-works example ---- */
.example-ui {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 0;
  margin: 1.2rem 0 2rem;
}
.example-form { margin-bottom: 1rem; }
.example-form select:disabled, .example-form input:disabled {
  color: var(--ink);
  opacity: 1;
  -webkit-text-fill-color: var(--ink);
}
.static-result { margin: 0; }

/* ---- track record ---- */
.stat-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1.2rem 0 .6rem; }
@media (min-width: 620px){ .stat-grid { grid-template-columns: repeat(3, 1fr); } }
.stat { border-top: 2px solid var(--accent); padding-top: .6rem; }
.stat-num { display: block; font-family: var(--serif); font-size: 2rem; line-height: 1.05; color: var(--ink); }
.stat-label { display: block; margin-top: .25rem; font-size: .9rem; color: var(--muted); }
.submission-list { display: grid; gap: 1rem; margin: 1rem 0; }
.submission-card {
  display: grid;
  grid-template-columns: 5.5rem minmax(8rem, .8fr) minmax(0, 1.4fr) 6.5rem;
  gap: .9rem;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.submission-label {
  display: block;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
  margin-bottom: .35rem;
}
.submission-stamp img {
  display: block;
  width: 5.5rem;
  height: 7rem;
  object-fit: contain;
  background: #111;
  border-radius: 3px;
  box-shadow: 0 1px 8px rgba(0,0,0,.14);
}
.submission-inputs, .submission-cert { font-size: .9rem; }
.submission-cert { font-weight: 650; }
.submission-estimate .grade-headline { margin-bottom: .35rem; }
.submission-estimate .grade-num { font-size: 1.8rem; }
.submission-estimate .grade-rank { font-size: .95rem; }
.submission-confidence { margin: -.2rem 0 .45rem; color: var(--muted); font-size: .86rem; font-weight: 650; }
.submission-estimate .bars { max-width: 100%; }
.submission-estimate .bar-col .pct { height: .9rem; font-size: .62rem; }
.submission-estimate .bar-col .track { height: 56px; }
.submission-estimate .bar-col .g { font-size: .66rem; }
@media (max-width: 680px) {
  .submission-card { grid-template-columns: 5.5rem 1fr; align-items: start; }
  .submission-estimate, .submission-cert { grid-column: 1 / -1; }
}

/* ---- tabs ---- */
.tabs { display: flex; flex-wrap: nowrap; justify-content: center; gap: .15rem; border-bottom: 1px solid var(--line); margin-top: .25rem; }
.tab {
  font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; background: none; border: none;
  border-bottom: 2px solid transparent; padding: .75rem .6rem; color: var(--muted); margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.panel { display: none; }
.panel.active { display: block; }
.hero { padding: 2.4rem 0 1rem; }   /* a touch tighter now that it sits under the tab bar */
@media (max-width: 760px) {
  .tabs { flex-wrap: wrap; justify-content: flex-start; }
}

/* ---- upload widget ---- */
.form-title { margin: 0 0 .8rem; font-size: 1.25rem; font-family: var(--sans); font-weight: 650; }
/* Upload-mode switch: a prominent segmented control (bulk opens a different UI, so it lives
   above the form, not among the optional fields). */
.mode-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 0 0 1.1rem; }
.mode-opt { font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; background: #fff; color: var(--muted); border: none; padding: .5rem 1rem; }
.mode-opt + .mode-opt { border-left: 1px solid var(--line); }
.mode-opt.active { background: var(--accent); color: #fff; }
.mode-opt:disabled { cursor: not-allowed; color: var(--faint); background: #faf8f2; }
.mode-opt .soon { font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; margin-left: .35rem; border: 1px solid currentColor; padding: .02rem .25rem; border-radius: 3px; vertical-align: middle; }
.readwarn {
  background: #fbf3e7; border: 1px solid #e7d8bd; border-radius: 2px;
  padding: .6rem .8rem; font-size: .88rem; color: #6b5836; margin: 0 0 1rem;
}
.uncertain-flag {
  display: flex; align-items: flex-start; gap: .6rem;
  background: #fcefe4; border: 1px solid var(--accent); border-left-width: 4px;
  border-radius: 3px; padding: .75rem .9rem; font-size: .92rem; color: #5a2a20;
  margin: 0 0 1.1rem;
}
.uncertain-flag .uflag-tag {
  flex: none; align-self: center; background: var(--accent); color: #fff;
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  padding: .2rem .45rem; border-radius: 2px;
}
.uncertain-flag b { color: var(--accent-d); }
/* JUMBO is a premium designation — green (matches the high-grade end of the chart),
   prominent, and distinct from the red uncertainty flag. */
.jumbo-flag {
  display: flex; align-items: center; gap: .6rem;
  background: #e9f3e3; border: 1px solid #4f9a52; border-left-width: 4px;
  border-radius: 3px; padding: .75rem .9rem; font-size: .92rem; color: #284b27;
  margin: .2rem 0 1.1rem;
}
.jumbo-flag .jflag-tag {
  flex: none; background: #3c8f57; color: #fff;
  font-size: .7rem; font-weight: 800; letter-spacing: .12em;
  padding: .22rem .5rem; border-radius: 2px;
}
.jumbo-flag b { color: #2f6b39; }
.uploader { margin: 1.5rem 0 1rem; }
.dropzone {
  display: flex; flex-direction: column; gap: .35rem; align-items: center; justify-content: center;
  text-align: center; cursor: pointer;
  background: var(--card); border: 1px dashed #cfc7b3; border-radius: 3px;
  padding: 2.2rem 1.25rem; color: var(--ink);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #fffef9; }
#dz-text { font-weight: 650; font-size: 1.05rem; }
.dz-note { font-size: .92rem; color: var(--muted); max-width: 30rem; line-height: 1.45; }
.dz-preview {
  max-width: min(100%, 22rem);
  max-height: 16rem;
  object-fit: contain;
  border-radius: 3px;
  background: #111;
  box-shadow: 0 1px 8px rgba(0,0,0,.16);
}
.dropzone.has-preview { padding-top: 1.25rem; padding-bottom: 1.25rem; }

.fields { display: grid; grid-template-columns: auto 1fr; gap: .8rem 1rem; align-items: center; margin: 1rem 0; }
.fields label { display: contents; font-size: 1rem; color: var(--muted); }
.fields select, .fields input[type=text] {
  font: inherit; font-size: 1rem; padding: .55rem .65rem; border: 1px solid var(--line);
  border-radius: 2px; background: var(--card); color: var(--ink); width: 100%;
}
.fields option:disabled { color: var(--faint); }
@media (max-width: 560px){ .fields { grid-template-columns: 1fr; } .fields label { display: block; } }

.uploader .btn-primary { margin-top: .2rem; }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.status { margin-left: .9rem; font-size: .95rem; color: var(--muted); }
.status.busy { display: inline-flex; align-items: center; gap: .5rem; }
.spinner {
  width: .9em; height: .9em; flex: none; border-radius: 50%;
  border: 2px solid rgba(138,42,43,.25);   /* accent at low opacity */
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.6s; } }
.disclaim { margin-top: 1.2rem; }
.privacy-note {
  margin: -.1rem 0 .9rem;
  font-size: .86rem;
  line-height: 1.45;
  color: var(--muted);
}

.result {
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: 3px; padding: 1.3rem 1.5rem 1.5rem; margin: 1.4rem 0;
}
.result .cap { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: .8rem; }
.result .estimate { font-family: var(--serif); font-size: 1.5rem; margin: 0 0 .1rem; }
.result .estimate b { color: var(--accent); }
.result .sub { color: var(--muted); font-size: .95rem; margin-bottom: 1rem; }
.result-details {
  display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem;
  margin: 1rem 0 0; padding-top: .9rem; border-top: 1px solid var(--line);
  font-size: .9rem;
}
.result-details dt { color: var(--muted); }
.result-details dd { margin: 0; font-weight: 600; }

/* ---- footer ---- */
.site-foot { border-top: 1px solid var(--line); margin-top: 4rem; padding: 2rem 0 3rem; color: var(--muted); font-size: .85rem; }
.site-foot p { margin: 0 0 .6rem; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--ink); }
.foot-links a { margin-right: 1.1rem; }
.beta-tag { display:inline-block; border:1px solid var(--line); border-radius:2px; padding:.05rem .45rem; font-size:.72rem; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
