/* ============================================================
   TOPIK I & II Form Nepal Companion — stylesheet
   Palette: cream base, deep wine/maroon accent, near-black ink
   Type: Sora (display) + Inter (body) + IBM Plex Mono (data/fields)
   ============================================================ */

:root {
  --cream: #f6f1ea;
  --card: #ffffff;
  --ink: #1c1a19;
  --muted: #6b625d;
  --border: #e8dfd6;
  --maroon: #7a2f3d;
  --maroon-dark: #5c222c;
  --maroon-tint: #f3e4e6;
  --success: #1f7a4d;
  --success-tint: #e6f4ec;
  --error: #b3392b;
  --error-tint: #fbe9e6;
  --warn: #9a6b1f;
  --warn-tint: #faf0dd;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 26, 25, 0.04), 0 8px 24px -12px rgba(28, 26, 25, 0.12);
  --font-display: "Sora", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

p { margin: 0 0 12px; color: var(--muted); }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 241, 234, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  max-width: 1080px;
  margin: 0 auto;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}

.brand .mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--maroon);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.tab-btn:hover { background: var(--maroon-tint); color: var(--maroon-dark); }
.tab-btn.active { background: var(--maroon); color: #fff; }

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

.hero {
  padding: 56px 0 32px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--maroon-dark);
  background: var(--maroon-tint);
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  max-width: 720px;
}

.hero .lede {
  font-size: 17px;
  max-width: 560px;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--maroon); color: #fff; }
.btn-primary:hover { background: var(--maroon-dark); }

.btn-outline { background: transparent; border-color: var(--maroon); color: var(--maroon); }
.btn-outline:hover { background: var(--maroon-tint); }

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Countdown ---------- */

.countdown-card {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 460px;
}

.countdown-unit {
  background: var(--card);
  padding: 16px 8px;
  text-align: center;
}

.countdown-unit .num {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--maroon);
}

.countdown-unit .label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 2px;
}

.countdown-note {
  font-size: 12.5px;
  margin-top: 10px;
  color: var(--muted);
}

/* ---------- Checklist / progress ---------- */

.progress-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin: 32px 0;
}

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.progress-pct {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--maroon);
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 18px;
}
.progress-bar > div {
  height: 100%;
  background: var(--maroon);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.check-item.done {
  color: var(--success);
  background: var(--success-tint);
  border-style: solid;
  border-color: transparent;
}

.check-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.check-item.done .dot { background: var(--success); }

/* ---------- Module sections ---------- */

.module {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 84px;
}

.module-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.module-head h2 { font-size: 24px; }
.module-head p { margin: 0; max-width: 520px; }

.module-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--cream);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"], input[type="file"], select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--cream);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus, select:focus { border-color: var(--maroon); }
input[type="file"] { font-family: var(--font-body); font-size: 13.5px; padding: 10px; cursor: pointer; }

.result-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.result-line.ok { color: var(--success); background: var(--success-tint); }
.result-line.bad { color: var(--error); background: var(--error-tint); }
.result-line.warn { color: var(--warn); background: var(--warn-tint); }
.result-line .icon { flex-shrink: 0; }

.output-box {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--maroon-dark);
  background: var(--maroon-tint);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  margin: 14px 0;
  word-break: break-word;
}

.note {
  font-size: 12.5px;
  color: var(--muted);
  border-left: 2px solid var(--border);
  padding-left: 10px;
  margin-top: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Stamp (signature element) ---------- */

.stamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 16px;
  border: 2px solid currentColor;
  border-radius: var(--radius-sm);
  transform: rotate(-3deg);
  position: relative;
}
.stamp.accepted { color: var(--success); }
.stamp.rejected { color: var(--error); }
.stamp::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid currentColor;
  border-radius: 5px;
  opacity: 0.5;
}

/* ---------- Photo tool ---------- */

.photo-frame {
  width: 177px;
  height: 236px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  margin: 0 auto 12px;
  overflow: hidden;
  background: repeating-conic-gradient(#f0eae2 0% 25%, #f6f1ea 0% 50%) 50% / 16px 16px;
  position: relative;
}
.photo-frame canvas { width: 100%; height: 100%; display: block; }

.photo-controls { display: flex; flex-direction: column; gap: 10px; }
.photo-controls label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
input[type="range"] { width: 100%; accent-color: var(--maroon); }

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
  margin-top: 16px;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 48px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.perforation {
  height: 1px;
  background-image: radial-gradient(circle, var(--border) 1.5px, transparent 1.5px);
  background-size: 10px 1px;
  background-repeat: repeat-x;
  margin: 0;
}

.hidden { display: none !important; }
