/* Hassan Khoshroo — memorial photo page.
   Look: Persian Thread v1. Deep header carries the weight,
   cream body carries the work. Gold is metal, not a utility color.
   Plain CSS, self-hosted fonts, light + dark grounds via CSS vars. */

/* ---------- Fonts (self-hosted, no CDN) ---------- */

@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/vazirmatn-arabic-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/vazirmatn-arabic-700-normal.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/vazirmatn-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/vazirmatn-latin-700-normal.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('/fonts/caveat-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('/fonts/caveat-latin-600-normal.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

/* ---------- Persian Thread tokens ---------- */

:root {
  /* Light: ivory marble, the same material as the lion emblem.
     Veining is painted in .deep-header below, kept very faint. */
  --header-ground: transparent;  /* the marble runs the whole page */
  --body-ground: #F4F2EE;        /* white marble, like the gold-lion render */
  --footer-ground: #ECE9E3;      /* half step deeper */
  --frame-white: #FCFBF8;
  --ink: #2C2825;
  --ink-muted: #6B655C;
  --header-ink: #2C2825;         /* text on the header ground */
  --header-ink-soft: #6B655C;
  --brass: #A8802F;              /* deeper brass so gold holds on ivory */
  --rust: #B8502C;
  --forest: #2C4A3A;
  --tricolor-mid: #D6C9B4;       /* cream stripe needs a visible value on light */
  --error: #8C3A2E;              /* muted brick, never bright red */
  --hairline-cream: #D8D3C9;     /* cooler hairline to sit on marble */
  --field-bg: #FDFCFA;
  --caption-ink: #2C2825;
  --btn-gold-bg: #C9963F;
  --btn-gold-ink: #2C2825;
  --btn-gold-fill: #B58335;
  --vein-a: rgba(140, 140, 148, 0.12);   /* cool gray veining, barely there */
  --vein-b: rgba(120, 120, 130, 0.08);
  --bloom-a: rgba(255, 255, 255, 0.6);
  --bloom-b: rgba(255, 255, 255, 0.35);
}

/* Dark ground: the deep Persian Thread look, kept behind the toggle. */
html[data-theme='dark'] {
  --header-ground: transparent;
  --body-ground: #26221E;        /* dark marble */
  --footer-ground: #241F1A;
  --ink: #EAE2D6;
  --ink-muted: #A99E8F;
  --header-ink: #F0E6DA;
  --header-ink-soft: #D8CBB8;
  --brass: #C9963F;
  --tricolor-mid: #F0E6DA;
  --hairline-cream: #4C4438;
  --field-bg: #352E27;
  --btn-gold-fill: #D8A954;
  --error: #D98B77;
  --vein-a: rgba(255, 255, 255, 0.05);
  --vein-b: rgba(255, 255, 255, 0.03);
  --bloom-a: rgba(255, 255, 255, 0.05);
  --bloom-b: rgba(255, 255, 255, 0.03);
}

/* ---------- Base ---------- */

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The hidden attribute must always win, even over display:flex rules below */
[hidden] { display: none !important; }

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

body {
  background-color: var(--body-ground);
  /* Light marble: soft blooms and two faint diagonal veins.
     If you can point at it, it is too strong. */
  background-image:
    radial-gradient(ellipse 90% 50% at 25% 0%, var(--bloom-a), transparent 60%),
    radial-gradient(ellipse 70% 40% at 80% 70%, var(--bloom-b), transparent 65%),
    linear-gradient(112deg, transparent 42%, var(--vein-a) 47%, transparent 53%),
    linear-gradient(74deg, transparent 63%, var(--vein-b) 68%, transparent 74%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

[lang='fa'] {
  font-family: 'Vazirmatn', -apple-system, sans-serif;
  line-height: 1.8;
}

/* English-only mode: the Farsi is drafted but not yet verified by a native
   speaker, so data-lang="en" on <html> hides every Farsi line. Remove that
   attribute after native-speaker review to go bilingual. The caption band
   is exempt — if someone TYPES Farsi, their own words still show. */
html[data-lang='en'] [lang='fa']:not(.band-caption) { display: none; }

/* ---------- Theme toggle (small, out of the way) ---------- */

.theme-toggle {
  position: absolute;
  top: 10px; right: 10px;
  width: 36px; height: 36px;
  border: none; border-radius: 50%;
  background: transparent;
  cursor: pointer;
  opacity: 0.4;
  z-index: 10;
}
.theme-toggle:hover { opacity: 0.85; }
.theme-toggle-icon {
  display: block; width: 16px; height: 16px; margin: 0 auto;
  border-radius: 50%;
  background: var(--header-ink-soft);
  box-shadow: inset -5px -4px 0 0 var(--header-ground);
}
html[data-theme='dark'] .theme-toggle-icon {
  box-shadow: none;
  background: var(--header-ink);
  opacity: 0.8;
}

/* ---------- ZONE 1: deep header ---------- */

.deep-header {
  position: relative;
  background: var(--header-ground);
  color: var(--header-ink);
  text-align: center;
  padding: 34px 20px 40px;
  border-bottom: 1px solid var(--hairline-cream);
}

.emblem {
  display: block;
  margin: 0 auto 18px;
  width: min(190px, 48vw);
  height: auto;
}

.title-caps {
  font-family: Georgia, 'Times New Roman', serif;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 14px;
  color: var(--header-ink-soft);
}

.name-en {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: 34px;
  letter-spacing: 0.02em;
  color: var(--brass);
  margin-top: 6px;
}

.name-fa {
  font-size: 21px;
  color: var(--header-ink);
  margin-top: 4px;
}

/* Tricolor hairline: green, cream, red. A rule, never a banner. */
.tricolor {
  display: flex;
  width: min(220px, 60vw);
  margin: 18px auto 26px;
}
.tricolor span { height: 2px; flex: 1; }
.tricolor span:nth-child(1) { background: var(--forest); }
.tricolor span:nth-child(2) { background: var(--tricolor-mid); }
.tricolor span:nth-child(3) { background: var(--rust); }

/* Portrait in a white frame, on the deep ground */
.portrait { margin: 0 auto; max-width: 420px; }
.portrait img {
  max-width: 100%;
  max-height: 54vh;
  border: 10px solid var(--frame-white);
  border-bottom-width: 12px;
  outline: 1px solid var(--hairline-cream);
  display: inline-block;
}
.portrait-placeholder {
  border: 10px solid var(--frame-white);
  outline: 1px solid var(--hairline-cream);
  background: #E2D8C8;
  height: 280px;
  display: flex; align-items: center; justify-content: center;
}
.portrait-placeholder-note {
  color: #6B655C; text-align: center; font-size: 14px;
}

/* ---------- ZONE 2: cream body ---------- */

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.ask { text-align: center; margin-bottom: 28px; }
.ask-en { font-size: 18px; }
.ask-fa { font-size: 17px; margin-top: 8px; }
.helper-en { font-size: 15px; color: var(--ink-muted); margin-top: 14px; }
.helper-fa { font-size: 14px; color: var(--ink-muted); margin-top: 6px; }

/* ---------- Buttons: the fill/slide primitive ---------- */

.btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: 4px;
  font-size: 17px;
  cursor: pointer;
  overflow: hidden;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.btn-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  transition: width 0.35s ease;
  pointer-events: none;
}
.btn:hover:not(:disabled) .btn-fill { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-label { position: relative; display: block; }
.btn-label .btn-en { display: block; }
.btn-label .btn-fa { display: block; font-size: 15px; opacity: 0.85; }

/* The ONE gold button per screen. Gold stays metal. */
.btn-gold { background: var(--btn-gold-bg); color: var(--btn-gold-ink); }
.btn-gold .btn-fill { background: var(--btn-gold-fill); }

.btn-secondary {
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--hairline-cream);
}
.btn-secondary .btn-fill { background: var(--hairline-cream); opacity: 0.4; }

/* During upload the Send fill becomes the progress bar */
.btn-send.uploading .btn-fill { transition: width 0.2s linear; }

.link-btn {
  display: block;
  margin: 12px auto 0;
  background: none; border: none;
  color: var(--ink-muted);
  font-size: 15px;
  text-decoration: underline;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}
.link-btn .btn-fa { display: block; font-size: 14px; }

/* ---------- Polaroid preview ---------- */

#polaroidBlock { margin: 4px 0 8px; }

.polaroid {
  /* margin 6.7% of width, band = 3x margin, window square */
  --pw: min(330px, 82vw);
  --pmargin: calc(var(--pw) * 0.067);
  width: var(--pw);
  margin: 0 auto;
  background: var(--frame-white);
  padding: var(--pmargin) var(--pmargin) 0;
  border: 1px solid var(--hairline-cream);
  transform: rotate(-1.2deg);
}
.polaroid-window {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--frame-white);
  overflow: hidden;
}
.polaroid-window img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  /* fit inside, never crop — a landscape stays landscape */
}
.preview-fallback {
  text-align: center;
  color: var(--ink-muted);
  background: #EFEBE2;
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 15px;
}
.polaroid-band {
  height: calc(var(--pmargin) * 3);
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px;
  overflow: hidden;
}
.band-caption {
  font-family: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
  font-size: calc(var(--pw) * 0.075);
  line-height: 1.15;
  color: var(--caption-ink);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.band-caption[dir='rtl'] {
  font-family: 'Vazirmatn', sans-serif;
  font-size: calc(var(--pw) * 0.055);
  line-height: 1.6;
}

/* ---------- Fields ---------- */

form { margin-top: 20px; }

.field { margin-bottom: 20px; }

label { display: block; margin-bottom: 6px; }
.label-en { display: block; font-size: 16px; font-weight: 600; }
.label-fa { display: block; font-size: 14px; color: var(--ink-muted); }

input[type='text'], input[type='tel'], input[type='email'], textarea {
  width: 100%;
  font-size: 16px;               /* 16px minimum or iOS zooms on focus */
  padding: 12px 14px;
  border: 1.5px solid var(--hairline-cream);
  border-radius: 4px;
  background: var(--field-bg);
  color: var(--ink);
  font-family: inherit;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--ink-muted);
}
::placeholder { color: #A99E8F; }

.field-help { margin-top: 5px; }
.help-en { display: block; font-size: 13.5px; color: var(--ink-muted); }
.help-fa { display: block; font-size: 12.5px; color: var(--ink-muted); }

.field-error { margin-top: 6px; color: var(--error); }
.err-en { display: block; font-size: 14px; }
.err-fa { display: block; font-size: 13px; }

/* Email: least important, visually smaller */
.field-email .label-en { font-size: 14px; font-weight: 400; color: var(--ink-muted); }
.field-email .label-fa { font-size: 12.5px; }
.field-email input { padding: 9px 12px; }

/* Honeypot: off-canvas, still fillable by bots */
.hp-wrap {
  position: absolute;
  left: -9999px; top: -9999px;
  height: 1px; width: 1px; overflow: hidden;
}

/* ---------- Send / progress / errors ---------- */

.btn-send { margin-top: 6px; }

.progress { text-align: center; margin-top: 16px; }
.progress-en { font-size: 16px; }
.progress-fa { font-size: 15px; }
.progress-patience { margin-top: 10px; color: var(--ink-muted); }
.patience-en { display: block; font-size: 14px; }
.patience-fa { display: block; font-size: 13px; }

.send-error { text-align: center; margin-top: 16px; }
.send-error-en { font-size: 16px; color: var(--error); }
.send-error-fa { font-size: 15px; color: var(--error); margin: 4px 0 12px; }

/* ---------- Thank you ---------- */

.thanks { text-align: center; padding-top: 8px; }
.thanks-h-en {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: 30px;
}
.thanks-h-fa { font-size: 20px; color: var(--ink-muted); margin: 2px 0 18px; }
.thanks-body-en { font-size: 18px; }
.thanks-body-fa { font-size: 16px; margin: 6px 0 18px; }
.thanks-again-en { font-size: 15px; color: var(--ink-muted); }
.thanks-again-fa { font-size: 14px; color: var(--ink-muted); margin: 4px 0 22px; }
.thanks .btn { max-width: 320px; margin: 0 auto; }
.video-line-en { margin-top: 28px; font-size: 14px; color: var(--ink-muted); }
.video-line-fa { font-size: 13px; color: var(--ink-muted); margin-top: 3px; }

/* ---------- ZONE 3: footer ---------- */

.deep-footer {
  background: var(--footer-ground);
  padding: 20px 20px 28px;
  text-align: center;
}
.tricolor-footer { margin: 0 auto 18px; width: min(160px, 50vw); }
.tricolor-footer span:nth-child(2) { background: var(--hairline-cream); }
.footer-emblems {
  display: flex; justify-content: center; align-items: center; gap: 28px;
}
.footer-emblem { width: 64px; height: auto; opacity: 0.9; }
.footer-family-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--ink-muted);
  font-size: 12.5px;
  text-decoration: none;
  letter-spacing: 0.06em;
}
.footer-family-link:hover { text-decoration: underline; }

/* ---------- Small screens ---------- */

@media (max-width: 380px) {
  .name-en { font-size: 28px; }
  .page { padding: 26px 14px 48px; }
}

@media (min-width: 700px) {
  .deep-header { padding-top: 44px; }
}
