/* Niko Keurulainen — CV site
   Palette: ink navy + warm sand accent, off-white paper. */

:root {
  --ink: #14181f;
  --ink-soft: #1c2129;
  --paper: #f6f3ee;
  --paper-2: #efeae1;
  --text: #23282f;
  --muted: #5d6470;
  --line: #dcd6ca;
  --sand: #c98a3c;
  --sand-deep: #a86d27;
  --cream: #f0e9dc;
  --maxw: 1120px;
  --pad: clamp(1.25rem, 5vw, 4rem);
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Georgia", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: .75rem 1rem; z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; border-radius: 6px; }

/* ---------- NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: .5rem clamp(1rem, 3vw, 2rem);
  padding: .85rem var(--pad);
  background: rgba(20, 24, 31, .82);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.nav__brand {
  flex: none;
  font-family: var(--serif);
  font-weight: 700; font-size: 1.15rem; letter-spacing: .12em;
  color: var(--cream);
  border: 1.5px solid rgba(201, 138, 60, .55);
  width: 2.4rem; height: 2.4rem;
  display: grid; place-items: center; border-radius: 50%;
}
/* Primary site nav (left, after brand) + in-page section jumps (right, CV) */
.nav__primary, .nav__sections {
  display: flex; align-items: center; gap: clamp(.9rem, 2.6vw, 1.9rem);
}
.nav__sections { margin-left: auto; } /* pushes section jumps to the right on desktop */
.nav__primary a, .nav__sections a {
  color: rgba(240, 233, 220, .78);
  font-size: .82rem; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 500; white-space: nowrap; transition: color .2s;
}
.nav__primary a:hover, .nav__sections a:hover { color: var(--sand); }
.nav__primary a[aria-current="page"] { color: var(--sand); }

/* ---------- HERO ---------- */
.hero {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(201, 138, 60, .18), transparent 60%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-soft) 100%);
  color: var(--cream);
  padding: clamp(3rem, 8vw, 6.5rem) var(--pad) clamp(3.5rem, 9vw, 7rem);
}
.hero__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 1.15fr .85fr;
  gap: clamp(2rem, 5vw, 4.5rem); align-items: center;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: .22em; font-size: .78rem;
  color: var(--sand); font-weight: 600; margin-bottom: 1.4rem;
}
.hero__name {
  font-family: var(--serif);
  font-weight: 700; line-height: .96;
  font-size: clamp(3rem, 9vw, 5.6rem);
  letter-spacing: -.01em; color: #fff;
  margin-bottom: 1.5rem;
}
.hero__lead {
  max-width: 44ch; color: rgba(240, 233, 220, .82);
  font-size: clamp(1rem, 1.4vw, 1.12rem); margin-bottom: 2rem;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-bottom: 2.6rem; }
.btn {
  display: inline-block; padding: .8rem 1.5rem; border-radius: 999px;
  font-weight: 600; font-size: .92rem; letter-spacing: .01em;
  transition: transform .15s, background .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--solid { background: var(--sand); color: #1a1206; }
.btn--solid:hover { background: #d89a4d; }
.btn--ghost { border: 1.5px solid rgba(240, 233, 220, .35); color: var(--cream); }
.btn--ghost:hover { border-color: var(--sand); color: var(--sand); }

.hero__stats {
  display: flex; gap: clamp(1.5rem, 4vw, 3rem); list-style: none;
  border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 1.6rem;
}
.hero__stats li { display: flex; flex-direction: column; }
.stat__num {
  font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: var(--sand);
  line-height: 1;
}
.stat__label { font-size: .78rem; color: rgba(240, 233, 220, .6); margin-top: .35rem; }

.hero__photo {
  position: relative; border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .1);
}
.hero__photo::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(20, 24, 31, .35) 100%);
}
.hero__photo img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- SECTIONS ---------- */
.section { padding: clamp(3.5rem, 8vw, 6.5rem) var(--pad); }
.section > *, .section__head, .grid2, .timeline, .refs, .contact__inner {
  max-width: var(--maxw); margin-left: auto; margin-right: auto;
}
.section--tint { background: var(--paper-2); }

.section__head { margin-bottom: 2.8rem; }
.section__kicker {
  display: inline-block; font-size: .76rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--sand-deep); font-weight: 700; margin-bottom: .9rem;
}
.section__head h2 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.08; letter-spacing: -.01em;
  color: var(--ink);
}
.section__intro { max-width: 52ch; color: var(--muted); margin-top: 1rem; }

/* ---------- TIMELINE ---------- */
.timeline { list-style: none; display: flex; flex-direction: column; gap: 0; }
.tl {
  display: grid; grid-template-columns: 200px 1fr; gap: clamp(1rem, 4vw, 3rem);
  padding: 2rem 0; border-top: 1px solid var(--line);
}
.tl:last-child { border-bottom: 1px solid var(--line); }
.tl__meta { display: flex; flex-direction: column; gap: .5rem; }
.tl__years { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.tl__tag {
  align-self: start; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  background: var(--sand); color: #1a1206; padding: .2rem .6rem; border-radius: 999px; font-weight: 700;
}
.tl__body h3 { font-size: 1.3rem; color: var(--ink); margin-bottom: .3rem; }
.tl__org { color: var(--sand-deep); font-weight: 600; margin-bottom: .8rem; }
.tl__desc { color: var(--muted); max-width: 58ch; }

/* ---------- REFERENCES ---------- */
.refs {
  list-style: none; display: grid; gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
}
.ref {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 1.5rem 1.4rem; display: flex; flex-direction: column; gap: .5rem;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.ref:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -18px rgba(20, 24, 31, .3); border-color: var(--sand); }
.ref__years { font-size: .78rem; letter-spacing: .06em; color: var(--sand-deep); font-weight: 700; }
.ref h3 { font-size: 1.12rem; color: var(--ink); line-height: 1.2; }
.ref p { color: var(--muted); font-size: .92rem; }
.ref--lead {
  grid-column: span 3;
  background: linear-gradient(120deg, var(--ink) 0%, var(--ink-soft) 100%);
  border-color: transparent;
}
.ref--lead h3 { color: #fff; font-family: var(--serif); font-size: 1.55rem; }
.ref--lead p { color: rgba(240, 233, 220, .78); }
.ref--lead .ref__years { color: var(--sand); }
.ref--lead:hover { transform: translateY(-3px); }

/* ---------- SKILLS / EDUCATION ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 4.5rem); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .7rem; }
.chips li {
  background: var(--cream); border: 1px solid var(--line);
  padding: .55rem 1rem; border-radius: 999px; font-size: .9rem; font-weight: 500; color: var(--ink);
}
.edu { list-style: none; display: flex; flex-direction: column; gap: 1.6rem; }
.edu__years { font-size: .78rem; letter-spacing: .06em; color: var(--sand-deep); font-weight: 700; }
.edu h3 { font-size: 1.15rem; color: var(--ink); margin: .2rem 0 .3rem; }
.edu p { color: var(--muted); font-size: .95rem; }
.interests {
  margin-top: 2rem; padding-top: 1.6rem; border-top: 1px solid var(--line);
}
.interests__label {
  display: block; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: .5rem;
}
.interests p { color: var(--ink); font-weight: 500; }

/* ---------- CONTACT ---------- */
.contact { background: var(--ink); color: var(--cream); }
.contact .section__kicker { color: var(--sand); }
.contact h2 { font-family: var(--serif); color: #fff; font-size: clamp(2rem, 5vw, 3rem); }
.contact__lead { color: rgba(240, 233, 220, .8); margin: 1rem 0 2.4rem; max-width: 46ch; }
.contact__links {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}
.contact__links > * {
  display: flex; flex-direction: column; gap: .3rem;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px; padding: 1.3rem 1.4rem; transition: border-color .2s, background .2s;
}
.contact__links a:hover { border-color: var(--sand); background: rgba(201, 138, 60, .08); }
.contact__k { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(240, 233, 220, .55); }
.contact__v { font-size: 1.05rem; font-weight: 600; color: #fff; word-break: break-word; }

/* ---------- FOOTER ---------- */
.foot {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between;
  padding: 1.8rem var(--pad); background: var(--ink-soft); color: rgba(240, 233, 220, .55);
  font-size: .85rem;
}
.foot a { color: var(--sand); }

/* ---------- REVEAL ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

.interests__link { color: var(--sand-deep); font-weight: 600; border-bottom: 1px solid rgba(168, 109, 39, .4); }
.interests__link:hover { color: var(--ink); }
.eyebrow--light { color: var(--sand); }

/* ================================================================
   HUB LANDING (/)
   ================================================================ */
.hub-hero {
  background:
    radial-gradient(1000px 520px at 82% -12%, rgba(201, 138, 60, .18), transparent 60%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-soft) 100%);
  color: var(--cream);
  padding: clamp(3rem, 8vw, 6rem) var(--pad) clamp(3rem, 8vw, 5.5rem);
}
.hub-hero__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 300px 1fr;
  gap: clamp(2rem, 5vw, 4rem); align-items: center;
}
.hub-hero__photo {
  border-radius: 16px; overflow: hidden;
  height: clamp(240px, 62vw, 340px); /* explicit height — no aspect-ratio dependency */
  box-shadow: 0 30px 60px -22px rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .1);
}
.hub-hero__photo img { width: 100%; height: 100%; object-fit: cover; }
.hub-hero__name {
  font-family: var(--serif); font-weight: 700; line-height: .96;
  font-size: clamp(2.6rem, 8vw, 4.8rem); letter-spacing: -.01em; color: #fff;
  margin-bottom: 1.2rem;
}
.hub-hero__lead {
  max-width: 46ch; color: rgba(240, 233, 220, .82);
  font-size: clamp(1rem, 1.4vw, 1.12rem); margin-bottom: 1.8rem;
}
.hub-hero__tags { display: flex; flex-wrap: wrap; gap: .6rem; list-style: none; }
.hub-hero__tags li {
  font-size: .82rem; letter-spacing: .02em; font-weight: 500;
  color: var(--cream); border: 1px solid rgba(240, 233, 220, .25);
  padding: .4rem .9rem; border-radius: 999px;
}

.topics { padding-top: clamp(2.5rem, 6vw, 4.5rem); }
.topic-grid {
  list-style: none; display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.topic {
  display: flex; flex-direction: column; height: 100%;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.8rem 1.7rem 1.6rem;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.topic:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -22px rgba(20, 24, 31, .35); border-color: var(--sand); }
.topic__kicker {
  font-family: var(--serif); font-size: 1.1rem; font-weight: 700; color: var(--sand-deep);
  opacity: .7;
}
.topic__title {
  font-family: var(--serif); font-weight: 700; font-size: 1.7rem; color: var(--ink);
  margin: .4rem 0 .7rem; line-height: 1.1;
}
.topic__ext { font-size: 1rem; color: var(--sand-deep); }
.topic__desc { color: var(--muted); font-size: .95rem; margin-bottom: 1.4rem; flex: 1; }
.topic__go {
  font-weight: 600; font-size: .9rem; color: var(--sand-deep);
  letter-spacing: .01em;
}
.topic:hover .topic__go { color: var(--ink); }

/* ================================================================
   PHOTOGRAPHY (/valokuvaus)
   ================================================================ */
.photo { background: #0f1216; color: #e9e6df; }
.nav--photo {
  background: rgba(15, 18, 22, .78);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.nav--photo .nav__primary a[aria-current="page"] { color: var(--sand); }
.nav--photo .nav__sections { border-top-color: rgba(255, 255, 255, .07); }

.photo-hero {
  position: relative; min-height: clamp(320px, 62vh, 560px);
  display: grid; align-items: end; overflow: hidden;
}
.photo-hero__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-hero__overlay {
  position: relative; z-index: 1; max-width: var(--maxw); width: 100%;
  margin: 0 auto; padding: 0 var(--pad) clamp(2rem, 6vw, 3.5rem);
  background: linear-gradient(180deg, transparent, rgba(10, 12, 15, .82));
  padding-top: clamp(4rem, 14vw, 8rem);
}
.photo-hero__title {
  font-family: var(--serif); font-weight: 700; color: #fff;
  font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.02; letter-spacing: -.01em;
  margin-bottom: .6rem;
}
.photo-hero__lead { color: rgba(233, 230, 223, .82); max-width: 48ch; font-size: clamp(1rem, 1.4vw, 1.1rem); }

.photo .section { padding: clamp(3rem, 7vw, 5rem) var(--pad); }
.gallery-grid {
  list-style: none; max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
}
.gcard {
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
  background: #171b20; border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.gcard:hover { transform: translateY(-4px); border-color: var(--sand); box-shadow: 0 22px 44px -24px rgba(0, 0, 0, .7); }
.gcard__media {
  height: clamp(170px, 24vw, 220px); display: grid; place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 12px, transparent 12px 24px),
    linear-gradient(135deg, #1d2229, #12151a);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.gcard__ph {
  font-family: var(--serif); font-size: 1.15rem; color: rgba(233, 230, 223, .35);
  letter-spacing: .04em;
}
.gcard__body { display: flex; flex-direction: column; padding: 1.3rem 1.4rem 1.4rem; flex: 1; }
.gcard__kicker { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--sand); font-weight: 700; }
.gcard__title { font-family: var(--serif); font-weight: 700; font-size: 1.4rem; color: #fff; margin: .35rem 0 .5rem; }
.gcard__desc { color: rgba(233, 230, 223, .6); font-size: .92rem; margin-bottom: 1.1rem; flex: 1; }
.gcard__go { font-weight: 600; font-size: .88rem; color: var(--sand); }

/* Gallery detail pages */
.gallery-head {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 4.5rem) var(--pad) 0;
}
.gallery-back {
  display: block; width: max-content; font-size: .85rem; color: rgba(233, 230, 223, .6);
  margin-bottom: 1.6rem; transition: color .2s;
}
.gallery-back:hover { color: var(--sand); }
.gallery-head .section__kicker { color: var(--sand); }
.gallery-head h1 {
  font-family: var(--serif); font-weight: 700; color: #fff;
  font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.05; letter-spacing: -.01em;
}
.gallery-intro { color: rgba(233, 230, 223, .65); margin-top: .8rem; max-width: 50ch; }
.gallery-section { max-width: var(--maxw); margin: 0 auto; }

.masonry {
  list-style: none; columns: 3 240px; column-gap: 1rem;
}
.masonry:empty { display: none; }
.shot-item { break-inside: avoid; margin-bottom: 1rem; }
.shot {
  display: block; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .07);
  transition: transform .18s, box-shadow .18s;
}
.shot:hover { transform: translateY(-3px); box-shadow: 0 18px 36px -20px rgba(0, 0, 0, .7); }
.shot img { width: 100%; height: auto; }

.gallery-empty {
  border: 1px dashed rgba(255, 255, 255, .16); border-radius: 14px;
  padding: clamp(2.5rem, 8vw, 4.5rem) 1.5rem; text-align: center;
  background: rgba(255, 255, 255, .015);
}
.masonry:not(:empty) + .gallery-empty { display: none; }
.gallery-empty__title { font-family: var(--serif); font-size: 1.5rem; color: #fff; margin-bottom: .5rem; }
.gallery-empty__note { color: rgba(233, 230, 223, .55); }

.photo .foot { background: #0c0f12; color: rgba(233, 230, 223, .5); }
.photo .foot a { color: var(--sand); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center;
  background: rgba(8, 10, 13, .94); padding: clamp(1rem, 4vw, 3rem);
}
.lightbox.open { display: flex; }
.lightbox__img { max-width: 100%; max-height: 82vh; border-radius: 6px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); }
.lightbox__cap { position: absolute; bottom: clamp(1rem, 4vw, 2.5rem); left: 0; right: 0; text-align: center; color: rgba(233,230,223,.8); font-size: .9rem; }
.lightbox__close {
  position: absolute; top: clamp(.8rem, 3vw, 1.5rem); right: clamp(.8rem, 3vw, 1.5rem);
  width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.06); color: #fff; font-size: 1.4rem; cursor: pointer;
  display: grid; place-items: center; line-height: 1;
}
.lightbox__close:hover { background: rgba(255,255,255,.14); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__photo { order: -1; max-height: 360px; }
  .refs { grid-template-columns: 1fr 1fr; }
  .ref--lead { grid-column: span 2; }
  .grid2 { grid-template-columns: 1fr; }
  .contact__links { grid-template-columns: 1fr; }
  .hub-hero__inner { grid-template-columns: 1fr; }
  .hub-hero__photo { max-width: 240px; }
  .topic-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }
}
/* Nav on small screens: primary stays on row 1; section jumps drop to a
   full-width, horizontally-scrollable strip on row 2 (nothing gets crammed). */
@media (max-width: 640px) {
  .nav { gap: .55rem clamp(.9rem, 3vw, 1.6rem); }
  .nav__sections {
    order: 3; flex-basis: 100%; margin-left: 0;
    margin-top: .6rem; padding-top: .6rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    gap: 1.4rem;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent;
  }
  .nav__sections::-webkit-scrollbar { height: 3px; }
  .nav__sections::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 3px; }
  .nav__sections a { font-size: .76rem; padding-bottom: .1rem; }
}
@media (max-width: 560px) {
  .nav__primary { gap: 1rem; }
  .nav__primary a { font-size: .76rem; letter-spacing: .05em; }
  .tl { grid-template-columns: 1fr; gap: .6rem; }
  .tl__meta { flex-direction: row; align-items: center; gap: .8rem; }
  .refs { grid-template-columns: 1fr; }
  .ref--lead { grid-column: span 1; }
  .hero__stats { flex-wrap: wrap; gap: 1.2rem; }
}
@media (max-width: 380px) {
  .nav__primary { gap: .8rem; }
  .nav__primary a { font-size: .72rem; }
}
