/* =========================================================
   davidbertalan.page: autumn palette
   Change colours here; everything else uses these tokens.
   ========================================================= */
:root {
  --bg: #f8f1e6;          /* parchment */
  --bg-alt: #f0e3cf;      /* warm sand */
  --surface: #fffaf2;
  --ink: #3a2a1f;         /* dark walnut */
  --ink-soft: #6b5546;
  --line: #e2cfb3;
  --rust: #b4532a;        /* primary accent */
  --rust-dark: #8f3f1f;
  --ochre: #c98a2b;
  --chestnut: #7a3e1d;
  --olive: #6f6a3a;
  --on-accent: #fffaf2;
  --shadow: 0 1px 2px rgba(58, 42, 31, .06), 0 8px 24px rgba(58, 42, 31, .08);

  --radius: 14px;
  --wrap: 1100px;
  --header-h: 64px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1611;
    --bg-alt: #261d16;
    --surface: #2c221a;
    --ink: #f1e4d2;
    --ink-soft: #c4ae95;
    --line: #45362a;
    --rust: #e0794a;
    --rust-dark: #f08c5e;
    --ochre: #e0a54a;
    --chestnut: #d08a5c;
    --olive: #b6b07a;
    --on-accent: #1d1611;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  overflow-x: hidden;
}
img, svg, iframe { max-width: 100%; }
a { color: var(--rust); text-underline-offset: 3px; }
a:hover { color: var(--rust-dark); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h3 { font-size: 1.2rem; font-weight: 500; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; border-radius: 4px; }

/* Placeholder / guess markers: easy to spot, easy to delete */
.guess {
  display: inline-block;
  font: 600 .68rem/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--chestnut);
  background: color-mix(in srgb, var(--ochre) 22%, transparent);
  border: 1px dashed var(--ochre);
  border-radius: 999px;
  padding: 3px 7px;
  vertical-align: middle;
  cursor: help;
}

/* ---------- Header + window tabs ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--chestnut); color: var(--on-accent);
  font: 700 .95rem/1 var(--serif);
}
.brand-name { font: 700 1.15rem/1 var(--serif); }

.tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: 999px;
}
.tabs a {
  text-decoration: none; color: var(--ink-soft);
  font: 500 .92rem/1 var(--sans);
  padding: 10px 16px; border-radius: 999px; white-space: nowrap;
  transition: background .2s, color .2s;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-selected="true"] { background: var(--chestnut); color: var(--on-accent); }
.tabs .short { display: none; }

/* Phone: brand on top, full-width tabs below */
@media (max-width: 719px) {
  :root { --header-h: 108px; }
  .header-inner { flex-direction: column; justify-content: center; align-items: stretch; gap: 8px; }
  .brand { justify-content: center; }
  .windows-nav .tabs a { flex: 1; text-align: center; padding: 10px 6px; font-size: .88rem; }
  .tabs .long { display: none; }
  .tabs .short { display: inline; }
}

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(ellipse at 85% 20%, color-mix(in srgb, var(--ochre) 22%, transparent), transparent 55%),
    radial-gradient(ellipse at 10% 90%, color-mix(in srgb, var(--rust) 14%, transparent), transparent 50%);
}
.hero-inner { display: grid; gap: 24px; align-items: center; padding-top: 48px; padding-bottom: 48px; }
@media (min-width: 860px) { .hero-inner { grid-template-columns: 1.2fr .8fr; padding-top: 80px; padding-bottom: 72px; } }
.eyebrow { font: 600 .8rem/1.2 var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--olive); margin-bottom: 12px; }
.hero h1 em { font-style: italic; color: var(--rust); }
.lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.hero-art { max-width: 360px; margin: 0 auto; width: 100%; }
@media (max-width: 859px) { .hero-art { max-width: 240px; order: -1; } }
.leaves .grid text { font: 500 26px var(--serif); fill: var(--line); }
.leaf { stroke-width: 1.5; }
.l1 { fill: var(--rust); stroke: var(--rust-dark); }
.l2 { fill: var(--ochre); stroke: var(--chestnut); }
.l3 { fill: var(--chestnut); stroke: var(--rust-dark); }
.l4 { fill: var(--olive); stroke: var(--olive); }
@media (prefers-reduced-motion: no-preference) {
  .leaf { animation: sway 6s ease-in-out infinite; transform-box: fill-box; transform-origin: top center; }
  .l2 { animation-delay: -1.5s; } .l3 { animation-delay: -3s; } .l4 { animation-delay: -4.5s; }
}
@keyframes sway { 0%, 100% { translate: 0 0; } 50% { translate: 4px 6px; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 12px 22px; border-radius: 999px;
  font: 600 1rem/1 var(--sans); text-decoration: none;
  border: 2px solid transparent; transition: transform .15s, background .2s, color .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--rust); color: var(--on-accent); }
.btn-primary:hover { background: var(--rust-dark); color: var(--on-accent); }
.btn-ghost { border-color: var(--chestnut); color: var(--chestnut); }
.btn-ghost:hover { background: var(--chestnut); color: var(--on-accent); }

/* ---------- Section nav (Teaching) ---------- */
.section-nav {
  position: sticky; top: var(--header-h); z-index: 10;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.section-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.section-nav ul::-webkit-scrollbar { display: none; }
.section-nav a {
  display: block; padding: 14px 12px; white-space: nowrap;
  text-decoration: none; color: var(--ink-soft); font: 500 .92rem/1 var(--sans);
  border-bottom: 3px solid transparent;
}
.section-nav a:hover { color: var(--ink); }
.section-nav a.active { color: var(--rust); border-bottom-color: var(--rust); }

/* Anchor targets land below both sticky bars */
.block { scroll-margin-top: calc(var(--header-h) + 52px); padding: 64px 0; }
@media (min-width: 860px) { .block { padding: 96px 0; } }
.block-alt { background: var(--bg-alt); }
.section-lead { color: var(--ink-soft); font-size: 1.1rem; max-width: 40em; margin-bottom: 32px; }
.section-lead.is-placeholder { font-style: italic; }

/* ---------- Who am I ---------- */
.two-col { display: grid; gap: 32px; align-items: center; }
@media (min-width: 860px) { .two-col { grid-template-columns: 320px 1fr; gap: 64px; } }
.portrait-frame {
  aspect-ratio: 4 / 5; max-width: 320px; margin: 0 auto; border-radius: 24px;
  background: linear-gradient(160deg, var(--ochre), var(--rust) 55%, var(--chestnut));
  display: grid; place-items: center; box-shadow: var(--shadow);
}
@media (max-width: 859px) { .portrait-frame { max-width: 200px; } }
.portrait-frame span { font: 700 4rem/1 var(--serif); color: var(--on-accent); opacity: .85; }
.facts { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 8px; }
.facts li { padding-left: 22px; position: relative; }
.facts li::before { content: "🍂"; position: absolute; left: 0; font-size: .85em; top: 2px; }

/* ---------- Cards (Why you) ---------- */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.card p { color: var(--ink-soft); margin: 0; }
.card-icon { font-size: 1.8rem; margin-bottom: 8px; }
.card-muted { box-shadow: none; border-style: dashed; background: transparent; }

/* ---------- Reasons (Why me) ---------- */
.reasons { list-style: none; counter-reset: r; padding: 0; margin: 0; display: grid; gap: 16px; }
@media (min-width: 720px) { .reasons { grid-template-columns: 1fr 1fr; gap: 24px 40px; } }
.reasons li { counter-increment: r; position: relative; padding: 4px 0 4px 64px; }
.reasons li::before {
  content: counter(r, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  font: 700 2rem/1 var(--serif); color: var(--ochre);
}
.reasons p { color: var(--ink-soft); margin: 0; }

/* ---------- Reviews ---------- */
.reviews { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.review {
  margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.review.is-sample { border-style: dashed; }
.stars { color: var(--ochre); letter-spacing: 2px; margin: 0 0 8px; }
.stars span { color: var(--line); }
.review blockquote { margin: 0 0 16px; font: 500 1.05rem/1.55 var(--serif); flex: 1; }
.review figcaption { display: flex; flex-direction: column; font-size: .92rem; }
.review figcaption span { color: var(--ink-soft); }
.reviews-cta { margin-top: 24px; text-align: center; }

/* ---------- Contact & booking ---------- */
.contact-grid { display: grid; gap: 24px; }
@media (min-width: 860px) { .contact-grid { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.booking iframe {
  width: 100%; height: 640px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff;
}
.booking-fallback { font-size: .9rem; margin-top: 8px; }
.booking-placeholder {
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 32px 24px; text-align: center; background: var(--surface);
  min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.booking-placeholder p { color: var(--ink-soft); max-width: 32em; }
.tag { font: 600 .72rem/1 var(--sans) !important; text-transform: uppercase; letter-spacing: .1em; color: var(--chestnut) !important; }
.contact-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.contact-list li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; overflow-wrap: anywhere; }
.contact-list .label { display: block; width: 100%; font: 600 .75rem/1 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--olive); }

/* ---------- ML window ---------- */
.net .edges path { stroke: var(--line); stroke-width: 2; fill: none; }
.net .n { stroke: var(--bg); stroke-width: 3; }
.n1 { fill: var(--rust); } .n2 { fill: var(--ochre); } .n3 { fill: var(--chestnut); } .n4 { fill: var(--olive); }
@media (prefers-reduced-motion: no-preference) {
  .net .n { animation: pulse 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .net .n2 { animation-delay: -1.2s; } .net .n3 { animation-delay: -2.4s; } .net .n4 { animation-delay: -3.6s; }
}
@keyframes pulse { 0%, 100% { scale: 1; } 50% { scale: 1.12; } }

.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.job { display: grid; gap: 4px 32px; padding: 24px 0; border-top: 1px solid var(--line); }
.job:first-child { border-top: 0; padding-top: 0; }
@media (min-width: 720px) { .job { grid-template-columns: 170px 1fr; } }
.job .when { margin: 0; font: 600 .85rem/1.6 var(--sans); color: var(--olive); text-transform: uppercase; letter-spacing: .06em; }
.job h3 { margin-bottom: .35em; }
.job .org { color: var(--rust); }
.job p, .job li { color: var(--ink-soft); }
.job ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.job li::marker { color: var(--ochre); }

.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font: 500 .88rem/1 var(--sans); padding: 7px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--ochre) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--ochre) 45%, transparent); color: var(--ink);
}
.skills .card h3 { margin-bottom: 14px; }
.langs { margin: 28px 0 0; color: var(--ink-soft); }
.langs strong { color: var(--ink); }

/* ---------- Placeholder windows ---------- */
.placeholder-window { padding-top: 64px; padding-bottom: 96px; min-height: 60vh; }
.cards-3 { margin-top: 32px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-alt); color: var(--ink-soft); font-size: .9rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 24px; padding-bottom: 24px; }
.footer-inner p { margin: 0; }

/* ---------- Review form (reviews subdomain) & admin ---------- */
.narrow { max-width: 680px; }
.page-narrow .block { padding-top: 40px; }
.review-form { margin-top: 32px; display: grid; gap: 20px; }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; padding: 0; }
.field-row { display: grid; gap: 20px; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }
.req, .opt { font: 500 .72rem/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--olive); margin-left: 6px; }
.req { color: var(--rust); }
.review-form input:not([type=radio]), .review-form select, .review-form textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.review-form textarea { resize: vertical; min-height: 140px; }
.review-form input:focus, .review-form select:focus, .review-form textarea:focus { outline: 3px solid var(--ochre); outline-offset: 1px; border-color: transparent; }
.hint { margin: 0; font-size: .85rem; color: var(--ink-soft); text-align: right; }
.privacy { font-size: .9rem; color: var(--ink-soft); margin: 0; }
.form-error { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--bg-alt); border-left: 4px solid var(--rust); }
.review-form .btn { justify-self: start; }
.review-form .btn:disabled { opacity: .6; cursor: progress; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Stars: radios in reverse order so hovering a star lights up the ones before it */
.rating { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating label { font-size: 2rem; line-height: 1; color: var(--line); cursor: pointer; padding: 2px; font-weight: 400 !important; }
.rating label:hover, .rating label:hover ~ label,
.rating input:checked ~ label { color: var(--ochre); }
.rating input:focus-visible + label { outline: 3px solid var(--ochre); border-radius: 6px; }

.thanks { margin-top: 32px; padding: 28px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.thanks:focus { outline: none; }

.admin-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.admin-filter button { font: 600 .95rem var(--sans); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer; }
.admin-filter button[aria-selected="true"] { background: var(--chestnut); border-color: var(--chestnut); color: var(--on-accent); }
.admin-list { display: grid; gap: 16px; }
.review blockquote { white-space: pre-line; }
.admin-meta { font-size: .85rem; color: var(--ink-soft); display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.admin-meta .stars { margin: 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-link { background: none; border-color: transparent; color: var(--ink-soft); }
.btn-link:hover { color: var(--rust); }
button.btn { cursor: pointer; background-color: transparent; }
button.btn-primary { background-color: var(--rust); }
button.btn-primary:hover { background-color: var(--rust-dark); }
