/* ==========================================================================
   Avik Poudel — portfolio
   One stylesheet for every page: a light, quiet palette with a muted
   slate-blue accent. Tokens first, then layout, then components.
   ========================================================================== */

:root {
  /* Colours from the original avikpoudel.com.np stylesheet */
  --bg: #f5f9fc;              /* old --light */
  --surface: #ffffff;
  --tint: #edf3f8;
  --secondary: #d1e7e1;       /* old --secondary (mint) */
  --ink: #1a2e40;             /* old --dark */
  --ink-2: #34495e;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;

  --accent: #2a5c82;          /* old --primary */
  --accent-hover: #1f4766;
  --accent-soft: rgba(42, 92, 130, .15);
  --focus: #7fa6c4;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(26, 46, 64, .04), 0 6px 18px rgba(26, 46, 64, .05);

  --font-display: "Times New Roman", Times, "Liberation Serif", serif;
  --font-body: "Times New Roman", Times, "Liberation Serif", serif;

  --header-h: 72px;
  --container: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
}

/* ---------- Base ---------- */

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

html {
  font-size: 106.25%; /* Times New Roman runs small; 1rem = 17px */
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--bg);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--ink);
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.9rem, 1.8vw + 1.1rem, 2.7rem);
  margin-bottom: 18px;
}

/* Longer paragraphs are justified on wider screens, with hyphenation so the word
   gaps stay even. Phone columns are too narrow for that, so they stay left-aligned. */
@media (min-width: 640px) {
  .lead,
  .hero__lead,
  .about p,
  .project p:not(.project__meta),
  .timeline__item p:not(.timeline__date):not(.timeline__place),
  .timeline__item li,
  .section-intro,
  .contact > div > p,
  .tool-card p,
  .page-hero p {
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
  }
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -64px;
  z-index: 300;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon {
  width: 1em; height: 1em;
  fill: currentColor;
  flex: none;
}

/* ---------- Header & navigation ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--header-h);
  color: var(--ink);
  transition: background-color .3s, box-shadow .3s;
}

.site-header.is-solid,
.site-header[data-open="true"] {
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  box-shadow: 0 1px 0 var(--line);
}

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  white-space: nowrap;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav__links {
  display: flex;
  gap: 2px;
  list-style: none;
}

.nav__links a {
  display: block;
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: .94rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .2s, background-color .2s;
}
.nav__links a:hover { color: var(--ink); background: rgba(26, 46, 64, .05); }
.nav__links a[aria-current] { color: var(--ink); background: rgba(26, 46, 64, .07); }

.nav-toggle {
  display: none;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 18px; height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .25s, background-color .25s;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1000px) {
  .nav-toggle { display: inline-grid; }

  .nav__menu {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    max-height: calc(100vh - var(--header-h));
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    padding: 12px var(--gutter) 24px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 20px 32px rgba(26, 46, 64, .08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s, transform .2s, visibility 0s .2s;
  }

  .site-header[data-open="true"] .nav__menu {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .2s, transform .2s;
  }

  .nav__links { flex-direction: column; gap: 2px; }
  .nav__links a { padding: 12px 10px; font-size: 1.05rem; color: var(--ink-2); }
  .nav__menu .btn { justify-content: center; }
}

/* ---------- Buttons & links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: .97rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
.btn:hover { background: var(--accent-hover); }
.btn .icon { width: .95em; height: .95em; }

.btn--outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--outline:hover { background: var(--surface); border-color: var(--ink-2); }

.btn--small { padding: 8px 14px; font-size: .9rem; }
.btn--block { width: 100%; justify-content: center; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: color .2s, border-color .2s;
}
.text-link:hover { color: var(--accent); border-color: var(--accent); }
.text-link .icon { width: .8em; height: .8em; transition: transform .2s; }
.text-link:hover .icon { transform: translateX(2px); }

/* ---------- Sections ---------- */

.section { padding-block: clamp(64px, 9vw, 112px); }
.section--white { background: var(--surface); border-block: 1px solid var(--line); }
.section--white .panel,
.section--white .tool-card { background: var(--bg); }

.section-label {
  margin-bottom: 10px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--accent);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  margin-bottom: 36px;
}
.section-head h2 { margin-bottom: 0; }
.section-intro { max-width: 46rem; color: var(--muted); margin-bottom: 36px; }

.lead { font-size: 1.14rem; line-height: 1.6; color: var(--ink-2); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}
.chips li {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: .85rem;
  line-height: 1.6;
}

/* ---------- Hero ----------
   The mountain photo sits behind the intro and fades into the page:
   pale on the left where the text is, clear on the right, gone at the bottom. */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: min(92vh, 860px);
  padding-top: calc(var(--header-h) + clamp(40px, 8vh, 112px));
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 68% 38%;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(245, 249, 252, .93) 30%, rgba(245, 249, 252, .55) 56%, rgba(245, 249, 252, .08) 100%),
    linear-gradient(0deg, var(--bg) 0%, rgba(245, 249, 252, .85) 16%, rgba(245, 249, 252, 0) 46%),
    linear-gradient(180deg, rgba(245, 249, 252, .7) 0%, rgba(245, 249, 252, 0) 20%);
}

.hero__text { max-width: 36rem; }

.eyebrow {
  margin-bottom: 14px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--accent);
}

.hero__title {
  margin-bottom: 20px;
  font-size: clamp(3rem, 6vw, 5.2rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.01em;
}

.hero__lead {
  margin-bottom: 30px;
  font-size: clamp(1.06rem, .6vw + .9rem, 1.22rem);
  color: var(--ink-2);
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 32px;
  margin: clamp(48px, 8vh, 96px) 0 0;
  padding-block: 24px clamp(40px, 6vw, 64px);
  border-top: 1px solid rgba(26, 46, 64, .12);
}
.hero__facts dt,
.facts dt {
  margin-bottom: 2px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--muted);
}
.hero__facts dd,
.facts dd { margin: 0; color: var(--ink); font-weight: 500; line-height: 1.45; }

@media (max-width: 860px) {
  .hero { min-height: 0; }
  .hero__bg { object-position: 40% 30%; }
  .hero::before {
    background:
      linear-gradient(180deg, rgba(245, 249, 252, .5) 0%, rgba(245, 249, 252, .74) 36%, rgba(245, 249, 252, .92) 68%, var(--bg) 100%);
  }
}
@media (max-width: 720px) {
  .hero__facts { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(40px, 7vw, 96px);
  align-items: center;
}

.about__photo { margin: 0; }
.about__photo img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: var(--radius);
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 32px;
  margin: 28px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .about__photo { max-width: 380px; }
}
@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr; }
}

/* ---------- Projects ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; }

.filter {
  padding: 7px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
.filter:hover { border-color: var(--ink-2); }
.filter[aria-pressed="true"] { background: var(--secondary); border-color: var(--accent); color: var(--ink); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 24px;
}

.project {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: box-shadow .25s, border-color .25s;
}
.project:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
.project[hidden] { display: none; }

.project__media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--tint);
  border-bottom: 1px solid var(--line);
}
.project__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s;
}
.project:hover .project__media img { transform: scale(1.03); }
.project__media--chart { background: #fff; }
.project__media--chart img { object-fit: contain; padding: 10px 6px 4px; }

.project__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px 22px 22px;
}
.project__meta { margin-bottom: 6px; font-size: .84rem; font-weight: 500; color: var(--muted); }
.project h3 { margin-bottom: 8px; font-size: 1.16rem; }
.project p:not(.project__meta) { color: var(--muted); font-size: .96rem; }
.project .text-link { margin-top: auto; align-self: flex-start; font-size: .92rem; }

/* ---------- Experience & education ---------- */

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(40px, 6vw, 80px);
  margin-top: 20px;
}

.col-title { margin-bottom: 22px; font-size: 1.05rem; color: var(--muted); font-weight: 600; }

.timeline {
  position: relative;
  margin-left: 5px;
  list-style: none;
  border-left: 1px solid var(--line-strong);
}
.timeline__item { position: relative; padding: 0 0 32px 26px; }
.timeline__item:last-child { padding-bottom: 4px; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: -6px; top: 6px;
  width: 11px; height: 11px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
}
.timeline__date { margin-bottom: 4px; font-size: .86rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.timeline__item h4 { margin-bottom: 2px; font-size: 1.15rem; }
.timeline__place { margin-bottom: 12px; color: var(--muted); font-size: .96rem; }
.timeline__item ul { padding-left: 18px; font-size: .98rem; }
.timeline__item li { margin-bottom: 6px; }
.timeline__item li::marker { color: var(--line-strong); }
.timeline__item p:last-child { margin-bottom: 0; }

.recognition {
  margin-top: clamp(44px, 6vw, 64px);
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.plain-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 12px 48px;
  list-style: none;
}
.plain-list li { position: relative; padding-left: 22px; }
.plain-list li::before {
  content: "";
  position: absolute;
  left: 2px; top: .62em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

@media (max-width: 860px) {
  .timeline-grid { grid-template-columns: 1fr; }
}

/* ---------- Skills ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 20px;
}
.skill-group {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.skill-group h3 { margin-bottom: 16px; font-size: 1.05rem; }

/* ---------- Tools ---------- */

.tools {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px;
  align-items: stretch;
}

.tool-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: box-shadow .25s, border-color .25s;
}
.tool-card:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
.tool-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.tool-card__body { display: flex; flex-direction: column; flex: 1; padding: 22px 24px 24px; }
.tool-card__body .tool-cta { margin-top: auto; }
.tool-card h3 { margin-bottom: 6px; font-size: 1.3rem; }
.tool-card p { color: var(--muted); }
.tool-cta { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; }
.tool-cta .icon { width: .85em; height: .85em; transition: transform .2s; }
.tool-card:hover .tool-cta .icon { transform: translateX(3px); }

.panel {
  padding: clamp(22px, 3.5vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.panel h2, .panel h3 { margin-bottom: 2px; font-size: 1.3rem; }
.panel-intro { color: var(--muted); font-size: .96rem; }

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin: 16px 0 20px;
  padding: 4px;
  border-radius: 12px;
  background: var(--tint);
}
.segmented button {
  padding: 7px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .2s, color .2s, box-shadow .2s;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(26, 46, 64, .1);
}

.field { margin-bottom: 16px; }
.field label,
.label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: .86rem;
  font-weight: 600;
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea.input { min-height: 132px; resize: vertical; }
select.input {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23667085' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}

.conv-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}
.conv-grid .field { margin-bottom: 0; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn .icon { width: 15px; height: 15px; }

.result {
  display: block;
  margin-top: 20px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--tint);
  color: var(--ink-2);
  font-size: clamp(1rem, 1vw + .7rem, 1.2rem);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.result small { display: block; margin-bottom: 2px; color: var(--muted); font-size: .8rem; }
.result strong { color: var(--ink); font-family: var(--font-display); font-weight: 600; }

@media (max-width: 900px) {
  .tools { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .conv-grid { grid-template-columns: 1fr; }
  .conv-grid .icon-btn { justify-self: center; transform: rotate(90deg); }
}

/* ---------- Travel strip ---------- */

.travel-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.travel-strip a { display: block; color: var(--ink); text-decoration: none; }
.travel-strip .frame { overflow: hidden; border-radius: var(--radius); background: var(--tint); }
.travel-strip img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform .6s; }
.travel-strip a:hover img { transform: scale(1.03); }
.travel-strip span { display: block; margin-top: 10px; font-size: .95rem; font-weight: 500; }

@media (max-width: 860px) {
  .travel-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}

/* ---------- Contact ---------- */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 6vw, 80px);
  align-items: start;
}
.contact h2 { max-width: 14ch; }
.contact > div > p { color: var(--muted); }

.contact-list { display: grid; gap: 12px; margin: 24px 0 28px; list-style: none; }
.contact-list li { display: flex; align-items: center; gap: 14px; color: var(--ink-2); }
.contact-list .icon-wrap {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
}
.contact-list .icon { width: 15px; height: 15px; }
.contact-list a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  overflow-wrap: anywhere;
  transition: color .2s, border-color .2s;
}
.contact-list a:hover { color: var(--accent); border-color: var(--accent); }

.social { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; }
.social a {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  transition: color .2s, border-color .2s;
}
.social a:hover { color: var(--accent); border-color: var(--accent); }
.social .icon { width: 17px; height: 17px; }

.form-note { margin: 12px 0 0; color: var(--muted); font-size: .86rem; }

@media (max-width: 860px) {
  .contact { grid-template-columns: 1fr; }
}

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

.site-footer {
  padding-block: 28px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .92rem;
}
.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer p { margin: 0; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }

.to-top {
  position: fixed;
  right: clamp(16px, 3vw, 28px);
  bottom: clamp(16px, 3vw, 28px);
  z-index: 90;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s, visibility 0s .25s, color .2s, border-color .2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .25s, color .2s, border-color .2s; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }
.to-top .icon { width: 14px; height: 14px; }

/* ---------- Sub-pages ---------- */

.page-hero {
  padding: calc(var(--header-h) + clamp(36px, 6vw, 72px)) 0 clamp(32px, 5vw, 52px);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.page-hero h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 2.5vw + 1rem, 2.9rem);
  letter-spacing: -.02em;
}
.page-hero p { max-width: 44rem; margin-bottom: 0; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: .92rem;
  text-decoration: none;
}
.back-link:hover { color: var(--ink); }
.back-link .icon { width: 11px; height: 11px; }

.page-body { padding-top: clamp(36px, 5vw, 56px); }

/* Gallery */
.gallery { columns: 3 300px; column-gap: 20px; }
.gallery__item {
  break-inside: avoid;
  margin: 0 0 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.gallery__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--tint);
  cursor: zoom-in;
}
.gallery__open img { width: 100%; transition: transform .5s; }
.gallery__open:hover img { transform: scale(1.02); }
.gallery__item figcaption { padding: 14px 18px 16px; }
.gallery__item h2 { margin-bottom: 2px; font-size: 1.05rem; letter-spacing: -.01em; }
.gallery__item p { margin: 0; color: var(--muted); font-size: .9rem; }

.lightbox {
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}
.lightbox::backdrop { background: rgba(14, 18, 23, .92); }
.lightbox__inner {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  height: 100%;
  padding: 68px clamp(12px, 8vw, 96px) 20px;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lightbox__caption { margin-top: 14px; text-align: center; color: rgba(255, 255, 255, .8); }
.lightbox__caption strong { display: block; color: #fff; }
.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, .18); }
.lightbox__btn .icon { width: 15px; height: 15px; }
.lightbox__close { top: 14px; right: 14px; }
.lightbox__prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 14px; top: 50%; transform: translateY(-50%); }

@media (max-width: 600px) {
  .lightbox__prev, .lightbox__next { top: auto; bottom: 16px; transform: none; }
  .lightbox__inner { padding-bottom: 80px; }
}

/* Calculators */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}
.calc-grid .panel h2 { font-size: 1.35rem; }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: block;
  height: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.choice label strong { display: block; color: var(--ink); font-family: var(--font-display); font-size: 1rem; }
.choice label span { color: var(--muted); font-size: .84rem; line-height: 1.35; }
.choice input:checked + label { border-color: var(--accent); background: var(--secondary); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }

.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.openings { display: grid; gap: 10px; margin-bottom: 12px; }
.opening { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.opening .icon-btn { width: 40px; height: 40px; }

.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}
.results[hidden] { display: none; }
.results div { padding: 14px 16px; background: var(--tint); color: var(--muted); font-size: .82rem; }
.results strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.results em { font-style: normal; }
.form-error { margin: 10px 0 0; color: #a33a2f; font-size: .88rem; font-weight: 500; }
.form-error:empty { display: none; }

.assumptions { margin-top: 18px; color: var(--muted); font-size: .88rem; }
.assumptions summary { color: var(--ink); font-weight: 600; cursor: pointer; }
.assumptions ul { margin-top: 8px; padding-left: 18px; }
.assumptions li { margin-bottom: 4px; }

@media (max-width: 900px) {
  .calc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .choice-grid, .row-2 { grid-template-columns: 1fr; }
}

/* ---------- Motion ---------- */

.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

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

/* ---------- Print ---------- */

@media print {
  .site-header, .to-top, .filters, #tools, #contact form { display: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
