/* ==========================================================================
   Teo Donnelly — implementation of the "Вариант A · Кабинет" design
   (design/Вариант A - Кабинет.dc.html). Tokens, type scale and spacing are
   taken from the mockup; layout is rebuilt as responsive CSS.
   ========================================================================== */

:root {
  /* Light theme — THEMES.light in the mockup */
  --bg: #f7f4ee;
  --bg-blur: rgba(247, 244, 238, .88);
  --surface: #fffdf9;
  --ink: #1c1917;
  --ink2: #3a342e;
  --muted: #6b6259;
  --line: #e2dbcf;
  --line2: #c9c0b1;
  --ph: #efeae0;
  --ph2: #e7e1d5;
  --accent: #8a5b3e;

  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-deva: "Noto Serif Devanagari", "Source Serif 4", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Corner radii — one place to tune the roundness of the whole page. */
  --r-btn: 10px;    /* buttons, header controls */
  --r-card: 16px;   /* cards, boxes, panels */
  --r-lg: 20px;     /* the portrait frame */
  --r-badge: 999px; /* "in preparation" pill */

  --wrap: 1240px;
  --pad-x: clamp(1.25rem, .3rem + 4vw, 4rem);   /* 20px → 64px */
  --sec-y: clamp(2.25rem, 1rem + 4.5vw, 5.5rem); /* 36px → 88px */
  --col-gap: clamp(1.75rem, .5rem + 4vw, 4.5rem);
  --head-col: 260px;
}

[data-theme="dark"] {
  --bg: #141210;
  --bg-blur: rgba(20, 18, 16, .88);
  --surface: #1b1815;
  --ink: #ece7de;
  --ink2: #c3bcb1;
  --muted: #948b80;
  --line: #2b2723;
  --line2: #403a33;
  --ph: #211e1a;
  --ph2: #191714;
  --accent: #b8825c;
}

/* --------------------------------------------------------------- base --- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

h1, h2, h3 { font-family: var(--font-serif); font-weight: 400; margin: 0; }
p { margin: 0; }
img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--ink); }

::selection { background: var(--accent); color: #fff; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: .75rem 1.25rem;
  border: 1px solid var(--line2);
}
.skip-link:focus { left: .75rem; top: .75rem; }

/* ------------------------------------------------------------- header --- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-blur);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 40px;
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(1rem, .95rem + .2vw, 1.19rem);
  white-space: nowrap;
}
.brandmark:hover { color: var(--ink); }

.mark {
  width: 30px;
  height: 30px;
  flex: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;          /* on the mark's own 120×120 grid */
  stroke-linecap: butt;
  stroke-linejoin: miter;
  stroke-miterlimit: 10;
}

.nav {
  display: none;
  margin-left: auto;
  gap: 26px;
  font-size: 14px;
}
.nav a {
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.nav a:hover,
.nav a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctl {
  min-width: 46px;
  height: 44px;
  padding: 0 12px;
  font: 500 13px/1 var(--font-sans);
  letter-spacing: .06em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line2);
  border-radius: var(--r-btn);
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}
.ctl:hover { color: var(--accent); border-color: var(--accent); }

.menu-btn { display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }

/* Theme toggle: the icon shows the theme currently active — sun for light,
   moon for dark — matching the language button, which shows the active language. */
.ctl-icon { display: inline-grid; place-items: center; padding: 0; width: 46px; }
.ctl-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
[data-theme="light"] .ctl-icon .icon-moon { display: none; }
[data-theme="dark"] .ctl-icon .icon-sun { display: none; }

.menu-panel {
  display: none;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.menu-panel.is-open { display: block; }
.menu-panel a {
  display: block;
  padding: 14px 0;
  color: var(--ink);
  font-size: 16px;
  border-bottom: 1px solid var(--line);
}
.menu-panel a:last-child { border-bottom: 0; }

@media (min-width: 1080px) {
  .controls { margin-left: 0; padding-left: 26px; border-left: 1px solid var(--line); gap: 10px; }
  .ctl { height: 36px; }
  .ctl-icon { width: 38px; }
  .nav { display: flex; }
  .menu-btn, .menu-panel { display: none !important; }
}

/* ------------------------------------------------------------ reveal --- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s cubic-bezier(.22, .61, .36, 1), transform .7s cubic-bezier(.22, .61, .36, 1);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* --------------------------------------------------------------- hero --- */

.hero { padding-block: clamp(2rem, .5rem + 5vw, 6rem) clamp(2.5rem, 1rem + 4.5vw, 5.5rem); }

/* Mobile order follows the mockup: heading, portrait, text, buttons. */
.hero-inner { display: grid; gap: clamp(20px, 12px + 1.5vw, 28px); align-items: start; }
@media (min-width: 1080px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr) 420px;
    grid-template-areas: "head figure" "body figure";
    column-gap: var(--col-gap);
    row-gap: 0;
  }
  .hero-head { grid-area: head; }
  .hero-figure { grid-area: figure; }
  .hero-body { grid-area: body; }
}

.eyebrow {
  font-size: clamp(11px, 10.5px + .1vw, 12px);
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.6;
}

.hero-name {
  font-size: clamp(34px, 20px + 3.4vw, 56px);
  line-height: 1.05;
  letter-spacing: -.015em;
  margin-top: clamp(18px, 10px + 1vw, 26px);
}

.hero-tagline {
  font-family: var(--font-serif);
  font-size: clamp(22px, 14px + 1.5vw, 30px);
  line-height: 1.3;
  margin-top: clamp(16px, 10px + .8vw, 26px);
  max-width: 19em;
  text-wrap: pretty;
}

.hero-sub {
  margin-top: 15px;
  padding-left: 15px;
  border-left: 2px solid var(--accent);
  font-size: clamp(14px, 13.5px + .1vw, 15px);
  line-height: 1.6;
  color: var(--muted);
  max-width: 32em;
}

.lead {
  font-family: var(--font-serif);
  font-size: clamp(17px, 15px + .3vw, 18px);
  line-height: 1.7;
  color: var(--ink2);
  margin-top: clamp(24px, 16px + 1vw, 32px);
  max-width: 34em;
  text-wrap: pretty;
}

.cta-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: clamp(24px, 16px + 1vw, 38px);
}
@media (min-width: 560px) { .cta-row { flex-direction: row; gap: 14px; } }

.btn {
  padding: 14px 26px;
  border-radius: var(--r-btn);
  font-size: 15px;
  text-align: center;
  border: 1px solid transparent;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--bg); }
.btn-ghost { border-color: var(--line2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

.portrait {
  margin: 0;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, var(--ph) 0 10px, var(--ph2) 10px 20px);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait.is-empty img { display: none; }

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

.section {
  border-top: 1px solid var(--line);
  padding-block: var(--sec-y);
}
.section-alt { background: var(--surface); }

.section-grid { display: grid; gap: var(--col-gap); align-items: start; }
@media (min-width: 1080px) {
  .section-grid { grid-template-columns: var(--head-col) minmax(0, 1fr); }
}

.section-label {
  font-size: clamp(11px, 10.5px + .1vw, 12px);
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-head h2 {
  font-size: clamp(28px, 18px + 1.6vw, 40px);
  line-height: 1.12;
  margin-top: clamp(12px, 8px + .5vw, 18px);
}

.prose {
  max-width: 34em;
  font-family: var(--font-serif);
  font-size: clamp(17px, 15px + .3vw, 18px);
  line-height: 1.75;
}
.prose p + p { margin-top: clamp(16px, 12px + .4vw, 20px); }
.prose-lg { font-size: clamp(17px, 14px + .5vw, 19px); }

.body-cols { display: grid; gap: var(--col-gap); align-items: start; }
@media (min-width: 1080px) { .body-cols { grid-template-columns: minmax(0, 1fr) 320px; } }

/* ------------------------------------------------------- sanskrit card --- */

.sanskrit {
  margin: clamp(24px, 16px + 1vw, 34px) 0;
  padding: clamp(20px, 14px + .8vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.section-alt .sanskrit { background: var(--bg); }
.sanskrit-deva { font-family: var(--font-deva); font-size: clamp(24px, 20px + .6vw, 28px); line-height: 1.3; }
.sanskrit-tr { font-family: var(--font-serif); font-style: italic; font-size: clamp(16px, 15px + .2vw, 17px); color: var(--accent); }
.sanskrit-gloss { font-size: clamp(14px, 13.5px + .2vw, 15px); line-height: 1.6; color: var(--muted); }

/* ------------------------------------------------------------- tenets --- */

.tenets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 10px + .3vw, 14px);
}
.tenets li {
  display: flex;
  gap: clamp(12px, 10px + .3vw, 14px);
  font-size: clamp(15px, 14px + .2vw, 16px);
  line-height: 1.6;
}
.tenets .num { color: var(--accent); font-size: clamp(12px, 11.5px + .1vw, 13px); padding-top: 3px; flex: none; }

/* -------------------------------------------------------------- aside --- */

.side-box {
  padding: clamp(22px, 16px + .8vw, 26px);
  border: 1px solid var(--line2);
  border-radius: var(--r-card);
  background: var(--surface);
}
.section-alt .side-box { background: var(--bg); }

.side-h {
  font-family: var(--font-sans);
  font-size: clamp(11px, 10.5px + .1vw, 12px);
  font-weight: 400;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.side-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
  font-size: 15px;
  line-height: 1.55;
}
.side-list--ruled li { padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.side-list--ruled li:last-child { padding-bottom: 0; border-bottom: 0; }

/* -------------------------------------------------------- link cards --- */

.cards2 { display: grid; gap: clamp(12px, 10px + .3vw, 16px); }
@media (min-width: 680px) { .cards2 { grid-template-columns: 1fr 1fr; } }

.link-card {
  padding: clamp(20px, 14px + .8vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color .2s ease, transform .2s ease;
}
.section-alt .link-card { background: var(--bg); }
.link-card:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--ink); }
.link-name { font-family: var(--font-serif); font-size: clamp(19px, 16px + .4vw, 22px); }
.link-desc { font-size: clamp(14px, 13.5px + .2vw, 15px); line-height: 1.55; color: var(--muted); }

/* ------------------------------------------------------------ projects --- */

.projects { display: flex; flex-direction: column; gap: clamp(14px, 12px + .4vw, 20px); }

.project {
  display: grid;
  gap: 14px;
  padding: clamp(24px, 16px + 1vw, 34px);
  border: 1px solid var(--line2);
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .2s ease;
}
.section-alt .project { background: var(--bg); }
.project:hover { border-color: var(--accent); color: var(--ink); }
@media (min-width: 900px) {
  .project { grid-template-columns: minmax(0, 1fr) 200px; gap: 40px; align-items: end; }
}

.project-name { font-family: var(--font-serif); font-size: clamp(25px, 18px + 1vw, 32px); line-height: 1.1; }
.project-desc { font-size: clamp(15px, 14px + .2vw, 16px); line-height: 1.65; color: var(--ink2); margin-top: 12px; max-width: 36em; }
.project-url { font: 400 13px/1 var(--font-mono); color: var(--accent); }
@media (min-width: 900px) { .project-url { text-align: right; } }

/* -------------------------------------------------------- consult cards --- */

.card {
  padding: clamp(20px, 14px + .8vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg);
}
.section-alt .card { background: var(--bg); }
.card-soon { border-style: dashed; border-color: var(--line2); background: transparent; }
.section-alt .card-soon { background: transparent; }

.card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card h3 { font-size: clamp(19px, 16px + .4vw, 21px); }
.card-soon h3 { color: var(--muted); }
.card p { font-size: clamp(14px, 13.5px + .2vw, 15px); line-height: 1.6; color: var(--muted); margin-top: 9px; }

.badge {
  font-size: clamp(10px, 9.5px + .1vw, 11px);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line2);
  border-radius: var(--r-badge);
  padding: 3px 7px;
  white-space: nowrap;
}

/* -------------------------------------------------------------- method --- */

.rules { display: flex; flex-direction: column; }

.rule-row {
  display: grid;
  gap: 8px;
  padding: clamp(18px, 14px + .4vw, 22px) 0;
  border-top: 1px solid var(--line);
}
.rule-row:last-child { border-bottom: 1px solid var(--line); }
@media (min-width: 900px) {
  .rule-row { grid-template-columns: 200px minmax(0, 1fr); gap: 40px; align-items: start; }
}
.rule-term { font-family: var(--font-serif); font-size: clamp(18px, 16px + .3vw, 19px); line-height: 1.35; }
.rule-desc { font-size: clamp(15px, 14px + .2vw, 16px); line-height: 1.65; color: var(--ink2); max-width: 32em; }

.callout {
  margin-top: clamp(22px, 16px + .8vw, 30px);
  padding: clamp(20px, 14px + 1vw, 28px);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--r-card) var(--r-card) 0;
  background: var(--surface);
}
.section-alt .callout { background: var(--bg); }
.callout p {
  font-family: var(--font-serif);
  font-size: clamp(16px, 14px + .3vw, 17px);
  line-height: 1.7;
  margin-top: 13px;
  max-width: 34em;
}

/* ------------------------------------------------------------- contact --- */

.contact-links { display: flex; flex-direction: column; gap: 10px; margin-top: clamp(22px, 16px + .6vw, 28px); }
@media (min-width: 560px) { .contact-links { flex-direction: row; gap: 14px; } }

/* -------------------------------------------------------------- footer --- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding-block: clamp(2rem, 1rem + 2vw, 3.25rem) clamp(2.75rem, 1.5rem + 2vw, 3.75rem);
}

.disclaimer {
  font-size: clamp(14px, 13.5px + .2vw, 15px);
  line-height: 1.7;
  color: var(--ink2);
  max-width: 60em;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: baseline;
  margin-top: clamp(22px, 16px + .8vw, 30px);
  padding-top: clamp(18px, 14px + .5vw, 24px);
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--accent); }
.footer-meta { color: var(--muted); font-size: 13px; width: 100%; }
@media (min-width: 900px) { .footer-meta { width: auto; margin-left: auto; font-size: 14px; } }

/* ------------------------------------------------------------- motion --- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .site-header, .cta-row, .contact-links { display: none; }
  body { background: #fff; color: #000; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
