/* Gezin — warm "paper & ink" editorial theme, phone-first.
   Display: Fraunces (soft serif). Body/UI: Hanken Grotesk. */

:root {
  --paper:      #f7f1e7;
  --paper-deep: #efe6d6;
  --card:       #fffdf9;
  --ink:        #2b2620;
  --ink-soft:   #7a6f60;
  --line:       #e7dcc9;
  --shadow:     0 1px 2px rgba(67, 52, 30, .06), 0 8px 24px -12px rgba(67, 52, 30, .22);
  --shadow-sm:  0 1px 2px rgba(67, 52, 30, .05);
  --radius:     16px;

  /* default accent (overridden per child via .accent-N) */
  --accent:      #b5542f;
  --accent-soft: #f2e1d6;
  --accent-deep: #8a3c1f;
}

/* per-child accent identities */
.accent-0 { --accent:#c25a3c; --accent-soft:#f5e2d8; --accent-deep:#8f3f29; } /* terracotta */
.accent-1 { --accent:#2f7d6b; --accent-soft:#dbeae4; --accent-deep:#1f5a4c; } /* pine */
.accent-2 { --accent:#c2891f; --accent-soft:#f4e8cd; --accent-deep:#8e6212; } /* ochre */
.accent-3 { --accent:#8a567f; --accent-soft:#ecdfe9; --accent-deep:#643c5b; } /* plum */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 12% -10%, #fcf7ee 0%, rgba(252,247,238,0) 55%),
    radial-gradient(90% 70% at 105% 8%, var(--accent-soft, #f2e1d6) 0%, rgba(255,255,255,0) 45%),
    var(--paper);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
}

/* subtle grain overlay for warmth */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%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)' opacity='0.045'/%3E%3C/svg%3E");
}

.container {
  position: relative; z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2rem) clamp(1rem, 4vw, 1.5rem) 4rem;
}

/* ---- masthead ---- */
.masthead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.75rem;
}
.brand { display: flex; flex-direction: column; gap: .1rem; }
.brand-mark {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600; font-size: clamp(2rem, 8vw, 2.7rem);
  font-optical-sizing: auto; letter-spacing: -.01em; line-height: .95;
}
.brand-date {
  color: var(--ink-soft); font-size: .92rem; font-weight: 500;
  text-transform: lowercase; letter-spacing: .01em;
}
.ghost-btn {
  font: inherit; font-size: .85rem; font-weight: 600;
  color: var(--ink-soft); background: transparent;
  border: 1px solid var(--line); border-radius: 999px;
  padding: .42rem .85rem; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--ink-soft); background: var(--card); }

/* ---- tabs (CSS-only, radio driven) ---- */
.tab-input { position: absolute; opacity: 0; pointer-events: none; }
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.tab {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: 1rem;
  padding: .5rem .95rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink-soft); cursor: pointer; user-select: none;
  transition: transform .12s ease, color .15s, border-color .15s, background .15s, box-shadow .15s;
}
.tab .dot {
  width: .62rem; height: .62rem; border-radius: 50%;
  background: var(--accent); opacity: .55; transition: opacity .15s, transform .15s;
}
.tab:hover { color: var(--ink); transform: translateY(-1px); }
.tab-input:focus-visible + .tab { outline: 2px solid var(--accent); outline-offset: 2px; }

/* active tab: filled with its child's accent */
#tab-0:checked ~ label[for="tab-0"],
#tab-1:checked ~ label[for="tab-1"],
#tab-2:checked ~ label[for="tab-2"],
#tab-3:checked ~ label[for="tab-3"] {
  background: var(--accent-soft); border-color: transparent;
  color: var(--accent-deep); box-shadow: var(--shadow-sm);
}
#tab-0:checked ~ label[for="tab-0"] .dot,
#tab-1:checked ~ label[for="tab-1"] .dot,
#tab-2:checked ~ label[for="tab-2"] .dot,
#tab-3:checked ~ label[for="tab-3"] .dot { opacity: 1; transform: scale(1.1); }

/* ---- week navigation ---- */
.weeknav {
  order: 99; width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin: 1.25rem 0 .25rem;
  padding-bottom: .9rem; border-bottom: 1px solid var(--line);
}
.week-label { font-weight: 600; font-size: .98rem; }
.week-label em { color: var(--ink-soft); font-style: normal; font-weight: 500; }
.nav-arrow {
  text-decoration: none; color: var(--ink);
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.1rem;
  border: 1px solid var(--line); background: var(--card);
  transition: background .15s, border-color .15s, transform .12s;
}
.nav-arrow:hover { background: var(--accent-soft); border-color: transparent; transform: translateY(-1px); }

/* ---- panels ---- */
.panels { order: 100; width: 100%; }
.panel { display: none; }
#tab-0:checked ~ .panels #panel-0,
#tab-1:checked ~ .panels #panel-1,
#tab-2:checked ~ .panels #panel-2,
#tab-3:checked ~ .panels #panel-3 { display: block; }

/* ---- day blocks ---- */
.day { padding-top: 1.4rem; animation: rise .45s cubic-bezier(.2,.7,.3,1) both; }
.day:nth-child(2) { animation-delay: .04s; }
.day:nth-child(3) { animation-delay: .08s; }
.day:nth-child(4) { animation-delay: .12s; }
.day:nth-child(5) { animation-delay: .16s; }
.day:nth-child(n+6) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.day-head { display: flex; align-items: baseline; gap: .65rem; margin-bottom: .7rem; }
.day-head h2 {
  margin: 0; font-family: "Fraunces", Georgia, serif;
  font-weight: 500; font-size: 1.28rem; letter-spacing: -.005em;
}
.today-pill {
  font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--accent);
  padding: .18rem .5rem; border-radius: 999px;
}
.day-today .day-head h2 { color: var(--accent-deep); }

.day-free { margin: 0; color: var(--ink-soft); font-size: .92rem; font-style: italic; }

/* ---- lesson cards ---- */
.lessons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.lesson {
  position: relative;
  display: grid; grid-template-columns: 3.4rem 1fr auto; align-items: center; gap: .9rem;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: .7rem .9rem;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .15s ease;
}
.lesson:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.when { display: flex; flex-direction: column; line-height: 1.15; font-variant-numeric: tabular-nums; }
.t-start { font-weight: 700; font-size: 1.02rem; }
.t-end { color: var(--ink-soft); font-size: .82rem; }
.what { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.vak {
  font-weight: 600; font-size: 1.02rem; letter-spacing: -.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.meta { color: var(--ink-soft); font-size: .86rem; }

.tag {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .2rem .5rem; border-radius: 999px; white-space: nowrap;
}
.tag-cancel { color: #9a2c20; background: #f7ddd7; }
.tag-mod { color: #8a5a0c; background: #f6e8c8; }

.lesson.is-cancelled { background: #fbf3f1; border-left-color: #c0503f; }
.lesson.is-cancelled .vak { text-decoration: line-through; color: #9a2c20; }
.lesson.is-cancelled .when { opacity: .65; }
.lesson.is-modified { border-left-color: #cf9a33; }

.empty { color: var(--ink-soft); font-style: italic; padding-top: 1.4rem; }

/* ---- no sources placeholder ---- */
.placeholder { text-align: center; padding: 3.5rem 1rem; color: var(--ink-soft); }
.placeholder h2 { font-family: "Fraunces", Georgia, serif; font-weight: 500; color: var(--ink); margin: .4rem 0; }
.ph-emoji { font-size: 2.6rem; margin: 0; }

/* ---- login ---- */
.login-body { display: grid; place-items: center; }
.login-wrap { position: relative; z-index: 1; width: 100%; padding: 1.5rem; min-height: 100vh; display: grid; place-items: center; }
.login-card {
  width: min(380px, 100%);
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 2.4rem 2rem; box-shadow: var(--shadow); text-align: left;
}
.login-kicker {
  margin: 0; color: var(--accent-deep); font-weight: 700;
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
}
.login-title {
  margin: .2rem 0 1.4rem; font-family: "Fraunces", Georgia, serif;
  font-weight: 600; font-size: 3rem; line-height: 1; letter-spacing: -.015em;
}
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field span { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field input {
  font: inherit; padding: .7rem .85rem;
  border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.submit-btn {
  margin-top: .4rem; font: inherit; font-weight: 700; font-size: 1rem;
  color: #fff; background: var(--accent); border: none; border-radius: 11px;
  padding: .8rem 1rem; cursor: pointer;
  transition: background .15s, transform .12s, box-shadow .15s;
  box-shadow: 0 6px 16px -8px var(--accent);
}
.submit-btn:hover { background: var(--accent-deep); transform: translateY(-1px); }
.submit-btn:active { transform: none; }
.error {
  margin: 0 0 1rem; padding: .65rem .8rem; font-size: .9rem;
  color: #9a2c20; background: #f7ddd7; border-radius: 11px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
