/* ==========================================================================
   Robert's Corner — shared stylesheet (linked by every page)
   Sections: 1 Tokens · 2 Base · 3 Layout · 4 Header/Nav · 5 Home
             6 Inner pages · 7 Components · 8 Footer · 9 Responsive · 10 Print
   ========================================================================== */

/* 1. DESIGN TOKENS ------------------------------------------------------- */
:root {
  /* Light palette (default) */
  --bg: #eef2f0;  --surface: #fff;  --ink: #12211f;  --soft: #4a5c58;
  --line: #cfd9d5;  --green: #1f5a4d;  --green-ink: #fff;
  --brass: #8a5f17;  --chip: #e1ebe7;  --ok: #17653a;
  /* Font stacks */
  --serif: "Newsreader", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tamil: "Noto Serif Tamil", "Latha", "Nirmala UI", serif;
}
/* Dark palette: follows the OS unless the visitor forced light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a18;  --surface: #152422;  --ink: #e6efec;  --soft: #9db1ab;
    --line: #2a3f3b;  --green: #5fc4a9;  --green-ink: #0b1513;
    --brass: #d9a84e;  --chip: #1d332f;  --ok: #6fd49a;
  }
}
/* Dark palette: forced by the theme button (saved in localStorage) */
:root[data-theme="dark"] {
  --bg: #0f1a18;  --surface: #152422;  --ink: #e6efec;  --soft: #9db1ab;
  --line: #2a3f3b;  --green: #5fc4a9;  --green-ink: #0b1513;
  --brass: #d9a84e;  --chip: #1d332f;  --ok: #6fd49a;
}
html { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* 2. BASE ---------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 4.5rem);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;   /* stop phones inflating text in landscape */
}
body {
  background: var(--bg); color: var(--ink);
  font: 400 1rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  overflow-x: clip;                      /* last-resort guard; does NOT break the sticky header */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--green); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); }

/* Skip link: visible only when focused by keyboard */
.skip { position: absolute; left: .8rem; top: -4rem; background: var(--green); color: var(--green-ink);
  padding: .5rem .9rem; border-radius: 6px; z-index: 50; text-decoration: none; }
.skip:focus { top: .8rem; }

/* 3. LAYOUT -------------------------------------------------------------- */
.wrap {
  max-width: 1040px; margin: 0 auto;
  padding-left:  max(1.4rem, env(safe-area-inset-left, 0px));    /* clear landscape notches */
  padding-right: max(1.4rem, env(safe-area-inset-right, 0px));
}
/* main also has class .wrap, so this needs the higher specificity to keep its vertical room */
main.wrap { padding-top: 3.5rem; padding-bottom: 5.5rem; min-height: 70vh; }

/* 4. HEADER + NAVIGATION ------------------------------------------------- */
/* Scoped to the page header only: the resume sheet has its own <header class="sh-head"> */
body > header { position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 20;
  padding-top: env(safe-area-inset-top, 0px); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .8rem; padding-bottom: .8rem; flex-wrap: wrap; }
.mark { font: 600 1.35rem/1 var(--serif); color: var(--ink); text-decoration: none; }
nav { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
nav a, .tool {
  font: 500 .93rem var(--sans); color: var(--soft); text-decoration: none;
  padding: .4rem .7rem; border-radius: 6px; background: none; border: 0; cursor: pointer;
}
nav a:hover, .tool:hover { color: var(--ink); }
nav a[aria-current="page"] { color: var(--green-ink); background: var(--green); }  /* current page */

/* Theme toggle: icon-only button. Moon in light mode, sun in dark mode. */
.tool.icon { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; padding: 0; border-radius: 50%; }
.tool.icon svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool.icon .i-sun { display: none; }
:root[data-theme="dark"] .tool.icon .i-sun { display: block; }
:root[data-theme="dark"] .tool.icon .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tool.icon .i-sun { display: block; }
  :root:not([data-theme="light"]) .tool.icon .i-moon { display: none; }
}

/* 5. HOME PAGE ----------------------------------------------------------- */
/* minmax(0, …) lets columns shrink below their content, so nothing can push the page wider than the screen */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }

/* Thirukkural: exactly two lines, bold Noto Serif Tamil.
   The figure is a size container. The font size is derived from ITS width, so the
   longer line (measured: 16.6 em at weight 700) always fits with a small safety margin
   and can never be clipped at the right edge, at any screen width. */
.kural-fig { container-type: inline-size; }
.kural {
  font-family: var(--tamil); font-weight: 700; line-height: 1.55; color: var(--green);
  font-size: clamp(1rem, 5vw, 2.15rem);                       /* fallback for browsers without container units */
}
@supports (width: 1cqw) {
  .kural { font-size: min(2.15rem, calc(100cqw / 17.4)); }    /* 17.4 = 16.6 em longest line + ~5% margin */
}
.kural span { display: block; white-space: nowrap; opacity: 0; transform: translateY(6px); animation: rise .7s ease forwards; }
.kural span:nth-child(2) { animation-delay: .25s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* Bilingual gloss + citation (colours come from the theme variables, so light and dark both work) */
.gloss { margin: .9rem 0 1.8rem; max-width: 34rem; color: var(--soft); }
.gloss .ta { font-family: var(--tamil); font-weight: 500; font-size: 1rem; line-height: 1.8; }
.gloss .en { font-family: var(--serif); font-style: italic; font-size: 1.05rem; line-height: 1.5; margin-top: .45rem; }
.gloss .cite { margin-top: .8rem; font: 600 .82rem/1.6 var(--sans); letter-spacing: .02em; color: var(--brass); }
.gloss .cite [lang="ta"] { font-family: var(--tamil); font-weight: 500; letter-spacing: 0; }
.gloss .cite .sep { margin: 0 .35em; color: var(--line); }

.avatar { display: block; width: 180px; height: 180px; object-fit: cover; border-radius: 50%; background: var(--chip); margin-top: 1.4rem; }
.lede { color: var(--soft); max-width: 34rem; margin-top: .8rem; font-size: 1.05rem; }
.social-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 1.15rem; margin-top: 1.1rem; }
.social-strip a { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; transition: transform .18s ease, opacity .18s ease; }
.social-strip a:hover { transform: translateY(-2px); opacity: .75; }
.social-strip img { display: block; width: 22px; height: 22px; object-fit: contain; }
:root[data-theme="dark"] .social-strip a[aria-label="GitHub"] img,
:root[data-theme="dark"] .social-strip a[aria-label="X"] img { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .social-strip a[aria-label="GitHub"] img,
  :root:not([data-theme="light"]) .social-strip a[aria-label="X"] img { filter: invert(1); }
}
.acts { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.6rem; }

/* Catalogue card / MARC record (ruled-paper look) */
.rec {
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  padding: 2.2rem 1.4rem 1.3rem; position: relative;
  background-image: repeating-linear-gradient(transparent 0 33px, var(--line) 33px 34px);
  background-position: 0 1.6rem;
}
.rec::before { /* the punched hole at the top of the card */
  content: ""; position: absolute; top: .7rem; left: 50%; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--bg); border: 1px solid var(--line);
}
.rec dl { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); font-size: .95rem; }
.rec dt { color: var(--brass); font-weight: 700; line-height: 34px; }
.rec dd { line-height: 34px; overflow-wrap: anywhere; }   /* long values such as the blog URL used to push the card off-screen */
.marc { font: .82rem/34px ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.marc b { color: var(--brass); }
.flip { margin-top: .8rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.flip button { font: 500 .82rem var(--sans); padding: .3rem .7rem; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--soft); cursor: pointer; }
.flip button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Three focus areas */
.areas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; margin-top: 5rem; }
.areas > div { border-top: 2px solid var(--green); padding-top: 1rem; }
.areas h3 { font-size: 1.25rem; margin-bottom: .4rem; }
.areas p { color: var(--soft); font-size: .95rem; }

/* 6. INNER PAGES (projects, about) --------------------------------------- */
h2.pg  { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h2.sec { font-size: 1.7rem; margin-top: 4.5rem; }
.sub { color: var(--soft); max-width: 38rem; margin: .6rem 0 1.6rem; }

/* Filter chips (projects) and tabs (about, gallery) */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tabs  { display: flex; gap: .5rem; margin: 1.4rem 0 1.8rem; flex-wrap: wrap; }
.chips button, .tabs button { font: 500 .9rem var(--sans); padding: .4rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--soft); cursor: pointer; }
.chips button[aria-pressed="true"], .tabs button[aria-selected="true"] { background: var(--green); color: var(--green-ink); border-color: var(--green); }

/* Project rows */
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.2rem; padding: 1.4rem 0; border-top: 1px solid var(--line); }
.row:last-child { border-bottom: 1px solid var(--line); }
.row h3 { font-size: 1.3rem; }
.row p { color: var(--soft); max-width: 40rem; margin-top: .3rem; font-size: .97rem; }
.row .go { display: flex; flex-direction: column; gap: .5rem; align-items: flex-end; min-width: 9.5rem; }
.live { font-size: .8rem; font-weight: 700; color: var(--ok); }
.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: .4rem; }

/* About: timeline + skills grid */
.tl { list-style: none; border-left: 2px solid var(--line); margin-left: .4rem; }
.tl li { position: relative; padding: 0 0 1.8rem 1.6rem; }
.tl li::before { content: ""; position: absolute; left: -7px; top: .55rem; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid var(--bg); }
.tl time { font-size: .85rem; font-weight: 700; color: var(--brass); }
.tl h3 { font-size: 1.2rem; }
.tl p { color: var(--soft); max-width: 40rem; font-size: .96rem; margin-top: .2rem; }
.skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem 2.4rem; }
.skills h3 { font-size: 1.1rem; }
.skills p { color: var(--soft); font-size: .95rem; }

/* Contact list */
.contact { display: grid; gap: .2rem; margin-top: 1.2rem; max-width: 30rem; }
.contact a { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); text-decoration: none; font-weight: 500; }
.contact a span { color: var(--soft); font-weight: 400; overflow-wrap: anywhere; text-align: right; min-width: 0; }

/* 6b. GALLERY ------------------------------------------------------------ */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.4rem; margin-top: 1.6rem; }
.shot button { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--chip); cursor: zoom-in; }
.shot img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; color: var(--soft); font-size: .85rem; }
.shot figcaption { margin-top: .5rem; color: var(--soft); font-size: .9rem; }
/* The lightbox sits on a fixed dark backdrop in both themes, so its white controls are intentional */
.lightbox { border: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100%; height: 100%; color: #fff; }
.lightbox::backdrop { background: rgba(8, 14, 13, .92); }
.lightbox[open] { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: 1rem; }
.lightbox figure { display: grid; justify-items: center; gap: .8rem; min-width: 0; }
.lightbox img { max-width: 100%; max-height: 78vh; max-height: 78dvh; object-fit: contain; border-radius: 4px; }
.lightbox figcaption { max-width: 40rem; text-align: center; font-size: .95rem; overflow-wrap: anywhere; }
.lb-n, .lb-x { width: 2.8rem; height: 2.8rem; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.lb-x { position: absolute; top: calc(1rem + env(safe-area-inset-top, 0px)); right: 1rem; }

/* 6c. CONTACT -------------------------------------------------------------- */
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 3.5rem; align-items: start; }
.split h3 { font-size: 1.3rem; margin-bottom: .8rem; }
.form { display: grid; gap: 1rem; }
.form label { display: grid; gap: .35rem; font-weight: 500; font-size: .93rem; }
.form input, .form textarea { font: 400 1rem var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .6rem .75rem; width: 100%; }
.form .btn { justify-self: start; }
.hint { color: var(--soft); font-size: .88rem; }

/* 6d. RESUME --------------------------------------------------------------- */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 2.4rem 2.6rem; max-width: 820px; margin-top: 2rem; }
.sh-head h1 { font-size: 2rem; }
.sh-head .role { color: var(--green); font-weight: 700; margin-top: .2rem; }
.sh-head .line { color: var(--soft); font-size: .9rem; overflow-wrap: anywhere; }
.sheet section { margin-top: 1.8rem; }
.sheet h2 { font-size: 1.15rem; color: var(--green); border-bottom: 1px solid var(--line); padding-bottom: .3rem; margin-bottom: .8rem; }
.rl { list-style: none; display: grid; gap: .8rem; }
.rl li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; }
.rl time { color: var(--brass); font-size: .85rem; font-weight: 700; padding-top: .15rem; }
.rl h3 { font-size: 1.02rem; }
.rl p { color: var(--soft); font-size: .93rem; }

/* 7. SHARED COMPONENTS --------------------------------------------------- */
.btn { display: inline-block; font: 700 .92rem var(--sans); padding: .65rem 1.1rem; border-radius: 6px; border: 1.5px solid var(--green); text-decoration: none; background: var(--green); color: var(--green-ink); cursor: pointer; }
.btn.alt { background: none; color: var(--green); }
.btn.sm { padding: .4rem .8rem; font-size: .84rem; }
.pills { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.pill { background: var(--chip); color: var(--soft); font-size: .78rem; padding: .15rem .6rem; border-radius: 4px; }

/* Back-to-top button (shown by script.js after scrolling) */
.totop { position: fixed; right: max(1rem, env(safe-area-inset-right, 0px)); bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); width: 2.6rem; height: 2.6rem;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: none; place-items: center; font-size: 1.1rem; }
.totop.show { display: grid; }

/* 8. FOOTER -------------------------------------------------------------- */
footer { border-top: 1px solid var(--line); margin-top: 2rem; padding: 2rem 0; color: var(--soft); font-size: .88rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* 9. RESPONSIVE + MOTION ------------------------------------------------- */
/* Tablets and below: hero stacks (the Kural keeps fitting because it sizes itself to its column) */
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
}

/* Phones and small tablets (360px to 768px) */
@media (max-width: 768px) {
  html { scroll-padding-top: 1rem; }
  main.wrap { padding-top: 2rem; padding-bottom: 3.5rem; }

  /* Header: brand on top with the theme button pinned at its right,
     the six links in a tidy 3 x 2 grid below. No more ragged wrapping.
     The header scrolls away on phones instead of eating two rows of the screen. */
  body > header { position: static; }
  .bar { position: relative; display: block; padding-top: .6rem; padding-bottom: .7rem; }
  .mark { display: flex; align-items: center; min-height: 2.4rem; font-size: 1.25rem; padding-right: 3rem; }
  nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; margin-top: .4rem; }
  nav a { display: grid; place-items: center; min-height: 2.5rem; padding: .3rem .4rem; text-align: center; }
  .bar .tool.icon { position: absolute; top: .6rem; right: max(1.4rem, env(safe-area-inset-right, 0px)); }

  /* Home */
  .avatar { margin-top: 1.1rem; }
  .gloss { margin-bottom: 1.4rem; }
  .gloss .cite span { display: block; }          /* Tamil part on one line, English part on the next */
  .gloss .cite .sep { display: none; }
  .rec { padding-left: 1rem; padding-right: 1rem; }
  .rec dl { grid-template-columns: 6rem minmax(0, 1fr); }
  .areas { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; margin-top: 3rem; }

  /* Inner pages */
  h2.sec { margin-top: 3rem; }
  .skills { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .row .go { align-items: flex-start; flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .split { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .form .btn { justify-self: stretch; width: 100%; text-align: center; }
  .rl li { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .sheet { padding: 1.6rem 1.1rem; }
  .sh-head h1 { font-size: 1.7rem; }

  /* Gallery: two columns, and lightbox arrows float over the picture instead of vanishing */
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .lightbox[open] { grid-template-columns: minmax(0, 1fr); padding: 1rem .6rem; }
  .lb-n { position: absolute; top: 50%; margin-top: -1.4rem; background: rgba(0,0,0,.45); }
  .lb-n.prev { left: .4rem; }
  .lb-n.next { right: .4rem; }
}

/* Small phones: keep tap targets comfortable */
@media (pointer: coarse) {
  .chips button, .tabs button, .flip button, .btn.sm { min-height: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .kural span { animation: none; opacity: 1; transform: none; }
}

/* 10. PRINT -------------------------------------------------------------- */
@media print {
  /* body > header only: the resume's own name/contact block (header.sh-head) must still print */
  body > header, footer, .flip, .tabs, .chips, .totop, .skip, .nopr, .sub { display: none; }
  body { background: #fff; color: #000; }
  main.wrap { padding: 0; min-height: 0; }
  .sheet { border: 0; padding: 0; max-width: none; }
}


/* MOBILE NAVIGATION -------------------------------------------------------
   Desktop keeps the horizontal navigation strip. On phones, the hamburger
   opens a floating panel over the page content instead of pushing content down. */
.mobile-menu-toggle { display: none; }
@media (max-width: 768px) {
  body > header { position: relative; z-index: 100; }
  .bar { position: relative; display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: .45rem; }
  .mark { flex: 1 1 auto; min-width: 0; padding-right: 0; white-space: nowrap; font-size: 1.15rem; }
  .bar > .tool.icon { position: static; flex: 0 0 2.4rem; margin: 0; }
  .mobile-menu-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 2.7rem; padding: .45rem .8rem; border: 1px solid var(--line);
    border-radius: .65rem; background: var(--surface); color: var(--ink);
    font: inherit; font-weight: 600; cursor: pointer;
  }
  .mobile-menu-toggle .menu-icon { font-size: 1.2rem; line-height: 1; }

  /* Floating overlay: one right-aligned link per row; page content stays in place. */
  #primary-nav {
    display: none;
    position: absolute;
    top: calc(100% + .35rem);
    right: max(1.4rem, env(safe-area-inset-right, 0px));
    z-index: 200;
    width: min( min(86vw, 21rem), calc(100vw - 2.8rem) );
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
    gap: .25rem;
    margin: 0;
    padding: .7rem;
    border: 1px solid var(--line);
    border-radius: .8rem;
    background: var(--surface);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .22);
  }
  #primary-nav.is-open { display: grid; }
  #primary-nav a {
    display: flex; justify-content: flex-end; align-items: center;
    width: 100%; min-height: 2.8rem; padding: .55rem .8rem;
    border-radius: .5rem; text-align: right; color: var(--ink);
  }
  #primary-nav a:hover { background: var(--chip); color: var(--ink); }

  /* Strong contrast for the current page in both light and dark themes. */
  #primary-nav a[aria-current="page"] {
    background: var(--green);
    color: var(--green-ink);
    font-weight: 700;
  }
  #primary-nav a[aria-current="page"]:hover {
    background: var(--green);
    color: var(--green-ink);
  }
  #primary-nav .tool.icon { justify-self: end; }
  .bar .tool.icon { position: static; justify-self: start; align-self: center; }
}


/* RESUME PDF PREVIEW ------------------------------------------------------ */
.resume-preview { max-width: 900px; margin: 2.5rem auto 0; }
.resume-preview h2 { font-size: 1.4rem; margin-bottom: .8rem; }
.pdf-frame { width: 100%; height: min(82vh, 1050px); min-height: 620px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.pdf-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.pdf-mobile-fallback { display: none; }
@media (max-width: 768px) {
  .pdf-frame { display: none; }
  .pdf-mobile-fallback { display: block; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
  .pdf-mobile-fallback p { color: var(--soft); margin-bottom: .9rem; }
  .resume-preview, .pdf-mobile-fallback { min-width: 0; }
}
/* Branded not-found page */
.not-found-card { max-width: 680px; margin: clamp(2rem, 8vw, 5rem) auto; padding: clamp(1.5rem, 5vw, 3rem); text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.not-found-card h1 { margin-bottom: .8rem; }
.not-found-card p { color: var(--soft); max-width: 38rem; margin: 0 auto 1.4rem; }
.not-found-actions { justify-content: center; }
:where(a, button, iframe, .not-found-card, .pdf-frame) { max-width: 100%; }


/* PAGE TRANSITIONS ---------------------------------------------------------
   Fade the page in on arrival and fade it out before internal navigation. */
body { opacity: 1; transition: opacity .2s ease; }
body.page-entered { opacity: 1; }
body.page-leaving { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  body { opacity: 1; transition: none; }
}

/* FINAL MOBILE HEADER OVERRIDE --------------------------------------------
   Brand left, theme control in the middle area, hamburger fixed at far right.
   The hamburger remains the last control in the header for easy reach. */
@media (max-width: 768px) {
  body > header .bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: .55rem;
  }
  body > header .bar > .mark {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 0;
    white-space: nowrap;
  }
  body > header .bar > #theme {
    position: static !important;
    inset: auto !important;
    order: 2;
    flex: 0 0 2.4rem;
    width: 2.4rem;
    height: 2.4rem;
    margin: 0 auto;
    justify-self: auto;
    align-self: center;
  }
  body > header .bar > #mobile-menu-toggle {
    order: 3;
    flex: 0 0 auto;
    margin-left: auto;
  }
}




/* PROJECT SERVICE HEALTH */
.status-summary { display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; margin:1.2rem 0 1.5rem; color:var(--soft); font-size:.88rem; }
.service-status { display:inline-flex; align-items:center; gap:.35rem; width:fit-content; margin-bottom:.65rem; padding:.24rem .58rem; border:1px solid var(--line); border-radius:999px; font:700 .76rem var(--sans); }
.service-status::before { content:""; width:.45rem; height:.45rem; border-radius:50%; background:currentColor; }
.status-checking, .status-unknown { color:var(--soft); }
.status-online { color:#16834a; border-color:color-mix(in srgb, #16834a 35%, var(--line)); }
.status-offline { color:#c04444; border-color:color-mix(in srgb, #c04444 35%, var(--line)); }
#refresh-status:disabled { opacity:.6; cursor:wait; }


/* Services page: responsive boxed service cards */
#plist { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%, 290px),1fr)); gap:1rem; margin-top:1rem; }
.service-card { min-width:0; display:flex; flex-direction:column; gap:.8rem; padding:1.25rem; border:1px solid var(--line); border-radius:14px; background:var(--surface); box-shadow:0 5px 18px rgba(18,33,31,.055); transition:transform .18s ease, box-shadow .18s ease; }
.service-card:hover { transform:translateY(-3px); box-shadow:0 10px 25px rgba(18,33,31,.10); }
.service-card-head { display:flex; align-items:center; gap:.9rem; min-width:0; }
.service-logo { width:54px; height:54px; flex:0 0 54px; object-fit:contain; padding:.35rem; border:1px solid var(--line); border-radius:12px; background:#fff; }
.service-card-title { display:flex; flex:1; min-width:0; align-items:flex-start; justify-content:space-between; gap:.5rem; flex-wrap:wrap; }
.service-card h3 { font-size:1.2rem; }
.service-card p { color:var(--soft); font-size:.94rem; }
.service-card .pills { margin-top:auto; }
.service-status { display:inline-flex; align-items:center; width:max-content; max-width:100%; border-radius:999px; padding:.18rem .55rem; font-size:.73rem; font-weight:700; background:var(--chip); color:var(--soft); }
.status-online { color:var(--ok); }
.status-offline { color:#a45a20; }
.status-unknown { color:var(--soft); }


/* Koha interface shortcuts inside the single Koha service card */
.koha-access-links { display:flex; flex-wrap:wrap; gap:.55rem; }
.koha-access-links button { display:inline-flex; align-items:center; justify-content:center; min-height:2.35rem; padding:.42rem .85rem; border:1px solid var(--green); border-radius:999px; background:transparent; color:var(--green); font:600 .86rem var(--sans); cursor:pointer; }
.koha-access-links button:hover { background:var(--green); color:var(--green-ink); }



/* ==========================================================================
   ROBERT'S CORNER — CONSOLIDATED DESIGN SYSTEM
   One responsive visual layer. Keeps existing HTML components and behaviour.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f4f5f0;
  --surface: #fffefa;
  --surface-raised: #ffffff;
  --ink: #192b25;
  --soft: #62736b;
  --line: #dce4dc;
  --green: #185b45;
  --green-strong: #104632;
  --green-ink: #ffffff;
  --brass: #9a6827;
  --chip: #eaf0e9;
  --ok: #24764d;
  --radius-card: 18px;
  --shadow-card: 0 12px 34px rgba(24, 48, 36, .065);
  --shadow-hover: 0 18px 42px rgba(24, 48, 36, .11);
  --page-width: 1160px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101a16;
  --surface: #17251e;
  --surface-raised: #1c2c24;
  --ink: #edf4ee;
  --soft: #aab9ae;
  --line: #304238;
  --green: #8bc9a7;
  --green-strong: #a5d9ba;
  --green-ink: #102017;
  --brass: #e2b66e;
  --chip: #24382d;
  --ok: #8ed6a6;
  --shadow-card: 0 12px 34px rgba(0, 0, 0, .18);
  --shadow-hover: 0 18px 42px rgba(0, 0, 0, .28);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101a16;
    --surface: #17251e;
    --surface-raised: #1c2c24;
    --ink: #edf4ee;
    --soft: #aab9ae;
    --line: #304238;
    --green: #8bc9a7;
    --green-strong: #a5d9ba;
    --green-ink: #102017;
    --brass: #e2b66e;
    --chip: #24382d;
    --ok: #8ed6a6;
    --shadow-card: 0 12px 34px rgba(0, 0, 0, .18);
    --shadow-hover: 0 18px 42px rgba(0, 0, 0, .28);
  }
}

html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
body {
  color: var(--ink);
  background:
    radial-gradient(ellipse at 10% 0%, rgba(73, 125, 92, .09), transparent 34rem),
    var(--bg);
  line-height: 1.7;
  letter-spacing: .005em;
}
.wrap {
  width: min(100% - 4rem, var(--page-width));
  max-width: var(--page-width);
  margin-inline: auto;
  padding-left: 0;
  padding-right: 0;
}
main.wrap {
  min-height: 66vh;
  padding-top: clamp(2.8rem, 6vw, 5.4rem);
  padding-bottom: clamp(3.5rem, 7vw, 6rem);
}
h1, h2, h3 { color: var(--ink); letter-spacing: -.035em; }
h1 { font-size: clamp(2.8rem, 6vw, 5rem); line-height: .99; }
h2.pg { font-size: clamp(2.35rem, 5vw, 3.8rem); line-height: 1.04; letter-spacing: -.05em; }
h2.sec { font-size: clamp(1.55rem, 3vw, 2.1rem); }
a { color: var(--green); text-underline-offset: .22em; }
a:hover { color: var(--green-strong); }

/* Header and navigation */
body > header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.bar {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding-top: .65rem;
  padding-bottom: .65rem;
}
.mark {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.055em;
  text-decoration: none;
}
nav { display: flex; align-items: center; justify-content: flex-end; gap: .2rem; margin-left: auto; }
nav a {
  color: var(--soft);
  border-radius: 999px;
  padding: .55rem .72rem;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  transition: color .18s ease, background .18s ease;
}
nav a:hover { color: var(--ink); background: var(--chip); }
nav a[aria-current="page"] { color: var(--green-ink); background: var(--green); }
.tool.icon {
  display: grid;
  place-items: center;
  flex: 0 0 2.65rem;
  width: 2.65rem;
  height: 2.65rem;
  padding: .55rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
}
.tool.icon:hover { background: var(--chip); }
.mobile-menu-toggle { display: none; }

/* Home hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, .82fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
}
.hero > div { min-width: 0; }
.kural-fig {
  margin: 0 0 2rem;
  padding: clamp(1.2rem, 2.7vw, 1.9rem);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 92%, var(--chip)), var(--surface));
  box-shadow: var(--shadow-card);
}
.kural { color: var(--green); font-size: clamp(1.08rem, 2vw, 1.65rem); line-height: 1.8; }
.gloss { max-width: 42rem; margin: .7rem 0 0; }
.gloss .ta { color: var(--soft); }
.gloss .en { color: var(--ink); }
.gloss .cite { color: var(--soft); font-size: .75rem; }
.hero h1 { max-width: 10ch; margin: 0 0 1rem; font-size: clamp(2.8rem, 6.1vw, 5.15rem); line-height: .98; letter-spacing: -.065em; }
.avatar {
  width: clamp(118px, 13vw, 158px);
  height: clamp(118px, 13vw, 158px);
  border: 5px solid var(--surface);
  outline: 1px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-card);
}
.lede { max-width: 38rem; color: var(--soft); font-size: clamp(1.03rem, 1.5vw, 1.18rem); line-height: 1.8; }
.social-strip { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.3rem; }
.social-strip a {
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  transition: transform .18s ease, background .18s ease;
}
.social-strip a:hover { background: var(--chip); transform: translateY(-3px); }
.acts { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.6rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: .72rem 1.15rem;
  border: 1px solid var(--green);
  border-radius: 999px;
  background: var(--green);
  color: var(--green-ink);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 5px 15px rgba(24, 91, 69, .12);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { color: var(--green-ink); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.btn.alt { background: var(--surface); color: var(--green); box-shadow: none; }
.btn.alt:hover { background: var(--chip); }
.btn.sm { min-height: 2.35rem; padding: .45rem .8rem; font-size: .82rem; }
.rec {
  position: relative;
  padding: 2.8rem 1.5rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background-color: var(--surface);
  background-image: repeating-linear-gradient(transparent 0 38px, color-mix(in srgb, var(--line) 65%, transparent) 38px 39px);
  background-position: 0 2rem;
  box-shadow: var(--shadow-hover);
}
.rec::before { top: .95rem; width: 12px; height: 12px; }
.rec dl { grid-template-columns: 6.3rem minmax(0, 1fr); font-size: .88rem; }
.rec dt, .rec dd { line-height: 39px; }
.flip { display: flex; justify-content: center; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.flip button, .tabs button, .chips button {
  min-height: 2.55rem;
  padding: .55rem .95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--soft);
  font: 600 .86rem var(--sans);
  cursor: pointer;
}
.flip button[aria-pressed="true"], .tabs button[aria-selected="true"] {
  border-color: var(--green);
  background: var(--green);
  color: var(--green-ink);
}
.areas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: clamp(3.5rem, 7vw, 6rem);
}
.areas > div {
  padding: 1.45rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--green);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform .2s ease, box-shadow .2s ease;
}
.areas > div:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.areas h3 { margin-bottom: .5rem; font-size: 1.25rem; }
.areas p { color: var(--soft); line-height: 1.75; }

/* Shared inner-page layout */
.sub { max-width: 48rem; margin: .9rem 0 2rem; color: var(--soft); font-size: 1.06rem; line-height: 1.8; }
.tabs, .chips { display: flex; flex-wrap: wrap; gap: .55rem; margin: 1.6rem 0 1.8rem; }
#tabbody { min-height: 8rem; }
.tl { border-left-color: var(--line); }
.tl li { padding-bottom: 2rem; }
.tl li::before { background: var(--green); box-shadow: 0 0 0 4px var(--bg); }
.tl time, .eyebrow { color: var(--brass) !important; font-size: .76rem !important; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.tl h3 { font-size: 1.3rem; }
.skills { gap: 1rem; }
.skills > div, .card {
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.skills h3 { margin-bottom: .45rem; font-size: 1.15rem; }
.research-list { display: grid; gap: 1rem; margin-top: 2rem; }
.research-list .row, .row {
  padding: 1.5rem 1.6rem;
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform .18s ease, box-shadow .18s ease;
}
.research-list .row:hover, .row:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.research-list .row h3, .row h3 { margin-top: .35rem; font-size: clamp(1.15rem, 2vw, 1.45rem); line-height: 1.3; }
.pills { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.pill { padding: .22rem .65rem; border-radius: 999px; background: var(--chip); color: var(--soft); font-size: .76rem; font-weight: 600; }
.contact { display: grid; max-width: 48rem; gap: .6rem; }
.contact a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.contact a:hover { transform: translateX(3px); border-color: var(--green); background: var(--chip); }
.contact a span { color: var(--soft); font-size: .9rem; text-align: right; }
.status-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem;
  padding: .9rem 1.1rem;
  margin: 1.2rem 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--soft);
}
#plist { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 1rem; }
.service-card {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  min-width: 0;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.service-card-head { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.service-logo { width: 48px; height: 48px; flex: 0 0 48px; object-fit: contain; padding: .4rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.service-card-title { display: flex; flex: 1; align-items: flex-start; justify-content: space-between; gap: .5rem; flex-wrap: wrap; min-width: 0; }
.service-card h3 { font-size: 1.2rem; }
.service-card p { color: var(--soft); line-height: 1.75; }
.service-card .pills { margin-top: auto; }
.service-status { display: inline-flex; align-items: center; gap: .35rem; width: fit-content; max-width: 100%; padding: .2rem .58rem; border: 1px solid var(--line); border-radius: 999px; background: var(--chip); color: var(--soft); font-size: .75rem; font-weight: 700; }
.service-status::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.status-online { color: var(--ok); }
.status-offline { color: #b56b32; }
.status-checking, .status-unknown { color: var(--soft); }
.koha-access-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.koha-access-links button { min-height: 2.4rem; padding: .45rem .85rem; border: 1px solid var(--green); border-radius: 999px; background: var(--surface); color: var(--green); font: 600 .85rem var(--sans); cursor: pointer; }
.koha-access-links button:hover { background: var(--chip); }

/* Gallery and image viewer */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.shot { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-card); }
.shot button { display: block; width: 100%; padding: 0; border: 0; overflow: hidden; background: var(--chip); cursor: zoom-in; }
.shot img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .35s ease; }
.shot button:hover img { transform: scale(1.04); }
.shot figcaption { padding: .75rem .9rem .9rem; color: var(--soft); font-size: .86rem; font-weight: 600; }
.lightbox { border: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100%; height: 100%; color: #fff; }
.lightbox::backdrop { background: rgba(8, 14, 13, .94); }
.lightbox[open] { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: 1rem; }
.lightbox figure { display: grid; justify-items: center; gap: .8rem; min-width: 0; }
.lightbox img { max-width: 100%; max-height: 78dvh; object-fit: contain; border-radius: 6px; }
.lightbox figcaption { max-width: 40rem; text-align: center; font-size: .95rem; overflow-wrap: anywhere; }
.lb-n, .lb-x { width: 2.8rem; height: 2.8rem; border: 1px solid rgba(255,255,255,.4); border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 1.6rem; cursor: pointer; }
.lb-x { position: absolute; top: calc(1rem + env(safe-area-inset-top, 0px)); right: 1rem; }

/* Resume and print */
.sheet { max-width: 820px; margin: 2rem auto 0; padding: 2.2rem; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-card); }
.sh-head h1 { font-size: 2rem; }
.sh-head .role { color: var(--green); font-weight: 700; }
.sh-head .line { color: var(--soft); font-size: .9rem; overflow-wrap: anywhere; }
.sheet section { margin-top: 1.8rem; }
.sheet h2 { margin-bottom: .8rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); color: var(--green); font-size: 1.15rem; }
.rl { display: grid; gap: .8rem; list-style: none; }
.rl li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; }
.rl time { padding-top: .15rem; color: var(--brass); font-size: .85rem; font-weight: 700; }
.resume-preview { max-width: 900px; margin: 2.5rem auto 0; }
.resume-preview h2 { margin-bottom: .8rem; font-size: 1.4rem; }
.pdf-frame { width: 100%; height: min(82vh, 1050px); min-height: 620px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.pdf-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.pdf-mobile-fallback { display: none; }
.not-found-card { max-width: 680px; margin: clamp(2rem, 8vw, 5rem) auto; padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); text-align: center; }
.not-found-card p { max-width: 38rem; margin: 0 auto 1.4rem; color: var(--soft); }
.not-found-actions { justify-content: center; }

/* Footer, utility controls and accessible focus */
footer { margin-top: 0; padding: 1.7rem 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 72%, var(--bg)); color: var(--soft); font-size: .84rem; }
footer .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.totop { position: fixed; right: max(1rem, env(safe-area-inset-right, 0px)); bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); z-index: 50; display: none; place-items: center; width: 2.7rem; height: 2.7rem; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); cursor: pointer; }
.totop.show { display: grid; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; }
:where(img, iframe, video, svg) { max-width: 100%; }
.skip { z-index: 1000; }

/* Responsive layout */
@media (max-width: 980px) {
  .wrap { width: min(100% - 3rem, var(--page-width)); }
  .bar { gap: .65rem; }
  nav a { padding: .5rem .55rem; font-size: .82rem; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(280px, .85fr); gap: 2rem; }
}
@media (max-width: 768px) {
  .wrap { width: min(100% - 2.25rem, var(--page-width)); }
  body > header { position: sticky; }
  .bar { position: relative; min-height: 68px; display: flex; flex-wrap: nowrap; gap: .55rem; }
  .mark { flex: 1 1 auto; min-width: 0; font-size: 1.25rem; white-space: nowrap; }
  .bar > #theme { order: 2; flex: 0 0 2.45rem; width: 2.45rem; height: 2.45rem; margin-left: auto; }
  .mobile-menu-toggle {
    order: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 2.55rem;
    padding: .45rem .75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font: 600 .85rem var(--sans);
    cursor: pointer;
  }
  #primary-nav {
    display: none;
    position: absolute;
    top: calc(100% + .45rem);
    right: 0;
    z-index: 200;
    width: min(86vw, 21rem);
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
    gap: .2rem;
    margin: 0;
    padding: .65rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-hover);
  }
  #primary-nav.is-open { display: grid; }
  #primary-nav a { display: flex; align-items: center; justify-content: flex-start; min-height: 2.7rem; padding: .55rem .8rem; border-radius: 10px; font-size: .9rem; }
  #primary-nav a[aria-current="page"] { background: var(--green); color: var(--green-ink); }
  main.wrap { padding-top: 2.5rem; padding-bottom: 3.8rem; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .hero h1 { max-width: none; font-size: clamp(2.8rem, 11vw, 4.2rem); }
  .avatar { width: 126px; height: 126px; margin-top: 1rem; }
  .kural-fig { margin-bottom: 1.5rem; padding: 1.1rem; border-radius: 17px; }
  .rec { max-width: 620px; padding: 2.7rem 1rem 1.2rem; }
  .rec dl { grid-template-columns: 5.5rem minmax(0, 1fr); font-size: .82rem; }
  .rec dt, .rec dd { line-height: 35px; }
  .areas { grid-template-columns: minmax(0, 1fr); gap: .85rem; margin-top: 2.8rem; }
  .areas > div { padding: 1.2rem; }
  .skills { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .row, .research-list .row { padding: 1.2rem; }
  .rl li { grid-template-columns: minmax(0, 1fr); gap: .15rem; }
  .contact a { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .contact a span { max-width: 100%; text-align: left; }
  .status-summary { align-items: flex-start; flex-direction: column; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .shot figcaption { padding: .65rem .7rem .8rem; font-size: .8rem; }
  .lightbox[open] { grid-template-columns: minmax(0, 1fr); padding: 1rem .6rem; }
  .lb-n { position: absolute; top: 50%; margin-top: -1.4rem; background: rgba(0,0,0,.48); }
  .lb-n.prev { left: .4rem; }
  .lb-n.next { right: .4rem; }
  .sheet { padding: 1.4rem 1rem; }
  .sh-head h1 { font-size: 1.7rem; }
  .pdf-frame { display: none; }
  .pdf-mobile-fallback { display: block; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .pdf-mobile-fallback p { margin-bottom: .9rem; color: var(--soft); }
  footer .wrap { flex-direction: column; align-items: flex-start; gap: .35rem; }
}
@media (max-width: 420px) {
  .wrap { width: min(100% - 2rem, var(--page-width)); }
  .mark { font-size: 1.12rem; }
  .mobile-menu-toggle { padding-inline: .65rem; }
  .hero h1 { font-size: 2.65rem; }
  .lede { font-size: 1rem; }
  .acts { display: grid; grid-template-columns: minmax(0, 1fr); }
  .acts .btn { width: 100%; }
  .gallery { gap: .55rem; }
}
@media (pointer: coarse) {
  .btn.sm, .tabs button, .chips button, .flip button, .koha-access-links button { min-height: 2.65rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  body > header, footer, .flip, .tabs, .chips, .totop, .skip, .sub, .nopr { display: none !important; }
  body { background: #fff; color: #000; }
  main.wrap { min-height: 0; padding: 0; }
  .sheet { max-width: none; padding: 0; border: 0; box-shadow: none; }
}
