/* ==========================================================================
   Demet Okyar · Portfolio
   ========================================================================== */

:root {
  --accent: #84EA02;       /* logo green: fills, highlights, dark backgrounds */
  --on-accent: #141414;    /* text on accent fills */
  --accent-text: #3A7400;  /* accent as text on light backgrounds (WCAG AA) */
  --ink: #141414;
  --ink-2: #45423D;
  --muted: #5E5B55;
  --paper: #FFFFFF;
  --chip: #ECEAE5;
  --chip-hover: #E3E0D9;
  --cream: #F3F1EC;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --cp: 24px;   /* card padding */
  --cp2: 32px;  /* large card padding */
  --g: 16px;    /* grid gap */
  --sh: 48px;   /* section head spacing */
  --pb: 48px;   /* page bottom padding */
  --radius: 28px;

  --sans: 'Geist', system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --serif: 'Instrument Serif', Georgia, serif;
}

@media (max-width: 639px) {
  :root {
    --cp: 20px;
    --cp2: 24px;
    --g: 12px;
    --sh: 32px;
    --pb: 112px;
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #F5F0EA 0%, #F1ECF4 50%, #F5EFE8 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }
::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }

@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46,180,90,.5); } 70% { box-shadow: 0 0 0 8px rgba(46,180,90,0); } 100% { box-shadow: 0 0 0 0 rgba(46,180,90,0); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes bob   { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
@keyframes drift { 0% { transform: translate(0,0) rotate(0) scale(1); } 50% { transform: translate(4%,-3%) rotate(8deg) scale(1.06); } 100% { transform: translate(-4%,3%) rotate(-6deg) scale(1); } }

/* ---------- Layout ---------- */

.page {
  max-width: 1344px;
  margin: 0 auto;
  padding: 0 clamp(14px, 5.3vw, 84px) var(--pb);
  display: flex;
  flex-direction: column;
  gap: var(--g);
}

.bg-blobs {
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(36% 36% at 18% 22%, rgba(132,234,2,.26), transparent 70%),
    radial-gradient(40% 40% at 82% 28%, rgba(140,110,255,.32), transparent 70%),
    radial-gradient(48% 44% at 50% 88%, rgba(255,196,120,.36), transparent 70%),
    radial-gradient(30% 30% at 88% 82%, rgba(90,170,255,.22), transparent 70%);
  filter: blur(48px);
  animation: drift 28s ease-in-out infinite alternate;
}

.row { display: flex; flex-wrap: wrap; gap: var(--g); }
.cell { display: flex; }
.cell > * { flex: 1; }

/* ---------- Type helpers ---------- */

.mono {
  font: 400 12px/16px var(--mono);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.serif-i {
  font-family: var(--serif);
  font-style: italic;
  letter-spacing: -.01em;
}
.accent { color: var(--accent-text); }
.teaser .accent, .next .tagline { color: var(--accent); }

/* ---------- Navigation ---------- */

.nav-desktop {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px -12px rgba(20,20,20,.2);
  max-width: calc(100vw - 32px);
  overflow-x: auto;
}
.nav-desktop a {
  padding: 8px 16px;
  border-radius: 999px;
  font: 500 13px/18px var(--sans);
  white-space: nowrap;
  transition: background .3s, color .3s;
}
.nav-desktop a:hover { background: var(--chip); }

.nav-mobile {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 100;
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px -12px rgba(20,20,20,.28);
}
.nav-mobile a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 8px;
  border-radius: 999px;
  font: 500 12px/14px var(--sans);
  white-space: nowrap;
  text-align: center;
  transition: background .3s, color .3s;
}

/* "Hi!" pill and active state */
.nav-desktop a.is-hi { font-weight: 300; transition: transform .4s var(--spring), background .3s, color .3s; }
.nav-desktop a.is-hi:hover { transform: rotate(-8deg) scale(1.08); }
.nav-desktop a.is-active,
.nav-mobile a.is-active,
.nav-desktop a.is-active:hover { background: var(--accent); color: var(--on-accent); }

@media (max-width: 639px) {
  .nav-desktop { display: none; }
  .nav-mobile { display: grid; }
}

/* ---------- Reveal animations ---------- */

[data-word] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .8s, transform .8s var(--ease);
}
.line-mask { display: block; overflow: hidden; padding-bottom: 8px; }
.line-mask > [data-word] {
  display: inline-block;
  opacity: 1;
  transform: translateY(110%);
  transition: transform 1.1s var(--ease);
}
[data-word].is-in { opacity: 1; transform: none; }

[data-reveal] {
  opacity: 0;
  transform: translateY(32px) scale(.97);
  transition: opacity .9s, transform .9s var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }
[data-reveal][data-delay="1"] { transition-delay: .08s; }
[data-reveal][data-delay="2"] { transition-delay: .16s; }
[data-reveal][data-delay="3"] { transition-delay: .2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-word], [data-reveal], .line-mask > [data-word] { opacity: 1; transform: none; }
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
  padding: var(--cp);
}
.card--lift { transition: transform .5s var(--ease), box-shadow .5s, background .4s, color .4s; }
/* .is-hover is only ever set on mouse/trackpad devices (see main.js) */
.card--lift.is-hover { transform: translateY(-4px); box-shadow: 0 32px 64px -32px rgba(20,20,20,.32); }

/* Touch devices: no hover motion, a short press feedback instead */
@media (hover: none) {
  [data-card], .r-item, .exp-item, .next, .back-link, .topic, .btn-pill, .btn-dark {
    transition: transform .25s var(--ease), background .3s, color .3s;
  }
  [data-card]:active, .next:active { transform: scale(.98); }
  .r-item:active, .back-link:active, .topic:active, .btn-pill:active, .btn-dark:active { transform: scale(.96); }
  .r-item:hover { transform: none; background: var(--chip); }
  .r-item--dark:hover { background: var(--ink); }
  .exp-item:hover { background: transparent; padding-left: 12px; }
  .next:hover, .detail-nav .back-link:hover { transform: none; }
  .modal-close:hover { transform: none; }
  .nav-desktop a.is-hi:hover { transform: none; }
  /* ambient motion replaces the hover-only star swing */
  .contact .star { animation: spin 14s linear infinite; }
}

[data-hover-to] { transition: transform .5s var(--ease); }

.tag {
  align-self: flex-start;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: 500 13px/18px var(--sans);
}
.chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--chip);
  font: 500 12px/16px var(--sans);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.btn-pill {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 20px;
  border-radius: 999px;
  border: none;
  background: var(--ink);
  color: #fff;
  font: 500 15px/22px var(--sans);
  cursor: pointer;
}
.btn-pill .dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 112px 0 128px;
  text-align: center;
}
.hero-avatar {
  position: relative;
  width: 176px;
  height: 176px;
  transform: translateY(16px) scale(.9);
  transition: opacity .8s, transform 1s var(--spring);
}
.hero-avatar svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  animation: spin 20s linear infinite;
}
.hero-avatar svg text { font: 500 6.4px var(--mono); fill: var(--accent-text); }
.hero-avatar img {
  position: absolute;
  /* proportional so the photo always sits inside the text ring */
  left: 15%;
  top: 15%;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  object-fit: cover;
  background: #D9D6CF;
}
.hero h1 {
  margin: 0;
  font: 600 clamp(35px, 5.3vw, 70px)/1 var(--sans);
  letter-spacing: -.05em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.hero h1 .serif-i { font-weight: 400; letter-spacing: -.02em; color: var(--accent-text); padding-right: 4px; }
.hero-lead {
  margin: 0;
  max-width: 512px;
  font: 400 16px/24px var(--sans);
  color: var(--ink-2);
  text-wrap: pretty;
}
.hero-loc {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
}
.hero-loc::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2EB45A;
  animation: pulse 2s infinite;
}
.hero-down {
  position: absolute;
  bottom: 32px;
  left: 50%;
  margin-left: -24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(20,20,20,.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transform: none;
}
.hero-down span { animation: bob 2.4s ease-in-out infinite; }

/* ---------- Intro: About / Skills / Social widgets ---------- */

.intro {
  display: grid;
  gap: var(--g);
  grid-template-columns: minmax(0, 1fr) minmax(0, .5fr) minmax(0, .5fr);
  grid-template-areas:
    "about skills skills"
    "about li     be";
}
.about-cell  { grid-area: about; }
.skills-cell { grid-area: skills; scroll-margin-top: 80px; }
.social-cell--li { grid-area: li; }
.social-cell--be { grid-area: be; }

.about {
  display: flex;
  flex-direction: column;
  justify-content: center;  /* heading and text stay together, centred in the card */
  gap: 20px;
}
.about-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; }
.about-name {
  margin: 0;
  font: 400 32px/1 var(--sans);
  letter-spacing: -.05em;
}
.about-head .tag { align-self: center; }
.about p {
  margin: 0;
  font: 400 16px/1.5 var(--sans);
  letter-spacing: -.02em;
  color: var(--muted);
  text-wrap: pretty;
}
.about b { color: var(--ink); font-weight: 500; }

/* Skills widget */
.skills { display: flex; flex-direction: column; gap: 16px; touch-action: pan-y; }
.skills-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.skills-title { margin: 0; font: 600 28px/1 var(--sans); letter-spacing: -.06em; }
.skills-title span { color: var(--accent-text); animation: blink 1s steps(1) infinite; }
.skills-hint { color: var(--muted); }
.skills-hint::after { content: "Drag them"; }
.pills { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  position: relative;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--chip);
  font: 500 12px/16px var(--sans);
  white-space: nowrap;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transform: translateY(-160px);
  transition: transform 1.1s var(--spring);
}
.pill--accent { background: var(--accent); color: var(--on-accent); }
@media (hover: none) {
  .skills-hint::after { content: "Tap them"; }
  .pill { cursor: pointer; touch-action: manipulation; }
}

/* Social widgets */
.social {
  height: 100%;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}
.social .glyph {
  font: 600 32px/.8 var(--sans);
  letter-spacing: -.06em;
  display: inline-block;
  align-self: flex-start;
  transform-origin: left bottom;
  transition: transform .6s var(--ease);
}
.social-meta { display: flex; justify-content: space-between; align-items: center; opacity: .72; }
.social-meta .arrow { display: inline-block; font-size: 16px; }
.social--li { background: var(--ink); color: var(--cream); }
.social--li.is-hover { background: #0A66C2; }
.social--be.is-hover { background: #1769FF; color: #fff; }

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

.teaser-wrap { padding-top: var(--sh); scroll-margin-top: 64px; }
.teaser {
  min-height: 464px;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 32px;
  padding: var(--cp2);
  background: var(--ink);
  color: var(--cream);
  transition: box-shadow .5s;
}
.teaser:hover { box-shadow: 0 40px 80px -40px rgba(20,20,20,.5); }
.teaser-copy {
  flex: 1 1 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  position: relative;
  z-index: 2;
}
.teaser-copy .mono { opacity: .64; }
.teaser h2 {
  margin: 0;
  font: 400 28px/1.1 var(--sans);
  letter-spacing: -.045em;
}
.teaser p {
  margin: 0;
  max-width: 400px;
  font: 400 15px/22px var(--sans);
  opacity: .72;
  text-wrap: pretty;
}
.teaser .btn-pill { background: var(--cream); color: var(--ink); }
.covers { flex: 1 1 360px; position: relative; min-height: 320px; }
.cover {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(64%, 320px);
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 48px -16px rgba(0,0,0,.6);
  transition: transform .9s var(--ease);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover--1 { transform: translate(-62%,-50%) rotate(-5deg); }
.cover--2 { transform: translate(-38%,-50%) rotate(5deg); }
.cover--3 { transform: translate(-50%,-50%); box-shadow: 0 32px 64px -16px rgba(0,0,0,.7); }
.teaser.is-hover .cover--1 { transform: translate(-118%,-46%) rotate(-10deg); }
.teaser.is-hover .cover--2 { transform: translate(18%,-54%) rotate(10deg); }
.teaser.is-hover .cover--3 { transform: translate(-50%,-56%) scale(1.08); }

/* Touch tablets: covers rest in a gentle fan that stays inside the card */
@media (hover: none) and (min-width: 640px) {
  .cover--1 { transform: translate(-96%,-48%) rotate(-8deg); }
  .cover--2 { transform: translate(-4%,-52%) rotate(8deg); }
  .cover--3 { transform: translate(-50%,-54%) scale(1.04); }
}

@media (max-width: 639px) {
  .teaser { min-height: 0; }
  .covers { min-height: 232px; }
  .cover { width: 52%; }
  /* covers are always fanned out on small screens */
  .cover--1, .teaser.is-hover .cover--1 { transform: translate(-118%,-46%) rotate(-10deg); }
  .cover--2, .teaser.is-hover .cover--2 { transform: translate(18%,-54%) rotate(10deg); }
  .cover--3, .teaser.is-hover .cover--3 { transform: translate(-50%,-56%) scale(1.08); }
}

/* ---------- Section head ---------- */

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  padding: var(--sh) 8px 8px;
  scroll-margin-top: 64px;
  transform: translateY(32px);
}
.section-head h2 {
  margin: 0;
  font: 400 28px/1.1 var(--sans);
  letter-spacing: -.04em;
}
.section-head .mono { color: var(--muted); }

/* ---------- Research ---------- */

.research-cell { flex: 2 1 520px; }
.research {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 224px), 1fr));
  gap: 16px;
}
.r-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--cp);
  border-radius: 20px;
  background: var(--chip);
  transition: transform .5s var(--ease), background .3s;
}
.r-item:hover { transform: translateY(-4px); background: var(--chip-hover); }
.r-item--dark, .r-item--dark:hover { background: var(--ink); color: #fff; }
.r-item .k { font: 500 12px/16px var(--mono); letter-spacing: .04em; color: var(--accent-text); }
.r-item--dark .k { color: var(--accent); }
.r-item .v { font: 500 16px/22px var(--sans); letter-spacing: -.02em; }

/* ---------- Education ---------- */

.edu-cell { flex: 1 1 296px; scroll-margin-top: 80px; }
.edu { display: flex; flex-direction: column; gap: 24px; }
.edu-item { display: flex; flex-direction: column; gap: 4px; }
.edu-item .t { font: 500 16px/22px var(--sans); letter-spacing: -.02em; }
.edu-item .s { font: 400 13px/18px var(--sans); color: var(--muted); }
.edu-more {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid rgba(20,20,20,.08);
}
.edu-more .mono { color: var(--muted); }

/* ---------- Experience ---------- */

.contact-row { padding-top: 48px; scroll-margin-top: 64px; }
.exp-cell { flex: 2 1 520px; }
.exp { display: flex; flex-direction: column; gap: var(--g); }
.exp-list { display: flex; flex-direction: column; }
.exp-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 12px;
  margin: 0 -12px;
  border-radius: 16px;
  transition: background .3s, padding .4s var(--ease);
}
.exp-item:hover { background: var(--chip); padding-left: 20px; }
.exp-item .role { display: flex; flex-direction: column; gap: 4px; }
.exp-item .t { font: 500 15px/22px var(--sans); }
.exp-item .s { font: 400 13px/18px var(--sans); color: var(--muted); }
.exp-item .y, .exp-early .y { font: 400 12px/16px var(--mono); color: var(--muted); }
.exp-early {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 24px;
  border-top: 1px solid rgba(20,20,20,.08);
}
.exp-early > .mono { color: var(--muted); }
.exp-early .line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 8px 0;
  font: 400 13px/18px var(--sans);
}
.exp-early .line b { font-weight: 500; }
.exp-early .line span span { color: var(--muted); }

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

.side-col { flex: 1 1 296px; display: flex; flex-direction: column; gap: var(--g); }
.side-col > .cell:first-child { flex: 1; }

.contact {
  min-height: 256px;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
}
.contact .top { display: flex; justify-content: space-between; width: 100%; }
.contact .star {
  position: absolute;
  right: -24px;
  top: 32px;
  width: 112px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 300 112px/1 var(--sans);
  opacity: .88;
  transition: transform .8s var(--ease);
}
.contact .bottom { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.contact .mail { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 400 15px/22px var(--sans); }
.copy-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: none;
  border-radius: 999px;
  background: rgba(20,20,20,.1);
  color: inherit;
  font: 500 12px/16px var(--sans);
  cursor: copy;
  transition: background .3s;
}
.copy-chip:hover { background: rgba(20,20,20,.18); }
.contact .connect {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: italic 400 28px/1 var(--serif);
}
.contact .connect span { display: inline-block; font: 400 26px/1 var(--sans); }

.cv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ink);
  color: #fff;
  font: 500 16px/22px var(--sans);
}
.cv .dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

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

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 8px 0;
  color: var(--muted);
}

/* ---------- Mail modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20,20,20,.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .4s, visibility 0s .4s;
}
.modal.is-open { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity .4s; }
.modal-box {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: #fff;
  border-radius: var(--radius);
  padding: var(--cp);
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 40px 80px -32px rgba(20,20,20,.5);
  transform: translateY(24px) scale(.96);
  transition: transform .6s var(--spring);
}
.modal.is-open .modal-box { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal-head > div { display: flex; flex-direction: column; gap: 8px; }
.modal-head .mono { color: var(--muted); }
.modal-head h3 { margin: 0; font: 400 28px/1.1 var(--sans); letter-spacing: -.04em; }
.modal-close {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--chip);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  transition: transform .4s var(--ease);
}
.modal-close:hover { transform: rotate(90deg); }

.form { display: flex; flex-direction: column; gap: var(--g); }
.form[hidden], .sent[hidden] { display: none; }
.field-label { font: 500 13px/18px var(--sans); }
.topics { display: flex; flex-direction: column; gap: 8px; }
.topic {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(20,20,20,.12);
  background: #fff;
  color: var(--ink);
  font: 500 13px/18px var(--sans);
  cursor: pointer;
  transition: background .3s, color .3s;
}
.topic[aria-pressed="true"] { background: var(--ink); color: #fff; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 8px; font: 500 13px/18px var(--sans); }
.form input, .form textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(20,20,20,.12);
  background: #F5F2EE;
  font: 400 15px/22px var(--sans);
  color: var(--ink);
  outline: none;
  transition: border-color .3s;
}
.form input:focus, .form textarea:focus { border-color: var(--accent); }
.form textarea { resize: vertical; }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-ghost {
  padding: 12px 0;
  border: none;
  background: none;
  font: 500 13px/18px var(--sans);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-send { transition: opacity .3s; }
.btn-send:disabled { opacity: .4; cursor: not-allowed; }

.sent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 0;
  text-align: center;
}
.sent .check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.sent .t { font: 500 18px/26px var(--sans); }
.sent .s { max-width: 360px; font: 400 13px/18px var(--sans); color: var(--muted); }
.btn-dark {
  padding: 12px 20px;
  border-radius: 999px;
  border: none;
  background: var(--ink);
  color: #fff;
  font: 500 13px/18px var(--sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.page-head { display: flex; flex-direction: column; gap: 24px; padding: 128px 0 48px; }
.back-link {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px 8px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font: 500 13px/18px var(--sans);
}
.back-link .dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-head h1 {
  margin: 0;
  font: 400 clamp(39px, 5.6vw, 77px)/.95 var(--sans);
  letter-spacing: -.05em;
}
.page-head h1 .serif-i { letter-spacing: -.02em; }
.page-head p {
  margin: 0;
  max-width: 560px;
  font: 400 16px/24px var(--sans);
  color: var(--ink-2);
  text-wrap: pretty;
}

.project-list { display: flex; flex-direction: column; gap: var(--g); }
.project-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--g);
  padding: var(--g);
  transition: box-shadow .5s;
}
.project-card.is-hover { box-shadow: 0 32px 64px -32px rgba(20,20,20,.28); }
.project-card .thumb { aspect-ratio: 4 / 3; border-radius: 20px; overflow: hidden; background: var(--chip); }
.project-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.project-card.is-hover .thumb img { transform: scale(1.05); }
.project-card .body { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 16px; }
.project-card .info { display: flex; flex-direction: column; gap: var(--g); }
.project-card .meta { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); }
.project-card h3 { margin: 0; font: 400 28px/1.1 var(--sans); letter-spacing: -.04em; }
.tagline { margin: 0; font: italic 400 18px/26px var(--serif); color: var(--accent-text); }
.project-card .sum { margin: 0; max-width: 440px; font: 400 15px/22px var(--sans); color: var(--ink-2); text-wrap: pretty; }

/* ---------- Project detail ---------- */

.detail-nav {
  position: sticky;
  top: 16px;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}
.detail-nav .back-link { transition: transform .4s var(--ease); }
.detail-nav .back-link:hover { transform: translateX(-4px); }
.detail-nav .index {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font: 400 12px/20px var(--mono);
  color: var(--muted);
}
.detail-head { display: flex; flex-direction: column; gap: 24px; padding: 96px 0 48px; }
.detail-head .mono { color: var(--muted); }
.detail-head h1 { margin: 0; font: 400 clamp(39px, 5.6vw, 77px)/.95 var(--sans); letter-spacing: -.05em; }
.detail-head .tagline { font-size: clamp(19px, 2.1vw, 28px); line-height: 1.1; }
.detail-cover {
  aspect-ratio: 4 / 3;
  max-height: 80vh;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #D9D6CF;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.overview { flex: 2 1 520px; display: flex; flex-direction: column; gap: var(--g); }
.overview p { margin: 0; font: 400 clamp(16px, 1.4vw, 19px)/1.4 var(--sans); letter-spacing: -.02em; text-wrap: pretty; }
.facts { flex: 1 1 296px; display: flex; flex-direction: column; gap: 24px; }
.fact { display: flex; flex-direction: column; gap: 4px; }
.fact .mono { color: var(--muted); }
.fact .v { font: 500 15px/22px var(--sans); }
.next {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
  align-items: center;
  padding: 16px;
  margin-top: 48px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--cream);
  transition: transform .5s var(--ease);
}
.next:hover { transform: translateY(-4px); }
.next .copy { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.next .copy .mono { opacity: .64; }
.next .name { font: 400 28px/1.1 var(--sans); letter-spacing: -.04em; }
.next .thumb { aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; background: #2A2A2A; }
.next .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   Tablet (640–1023px)
   ========================================================================== */
@media (min-width: 640px) and (max-width: 1023px) {
  :root { --cp: 24px; --cp2: 28px; --g: 14px; --sh: 40px; }

  .hero { padding: 120px 0 128px; }
  .hero h1 { font-size: clamp(42px, 6.3vw, 56px); }

  /* intro: About on top, Skills next to the two social widgets */
  .intro {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    grid-template-areas:
      "about  about"
      "skills li"
      "skills be";
  }
  .about { gap: 20px; }

  .teaser { min-height: 0; flex-direction: column; gap: 24px; }
  .teaser-copy { flex: none; }
  .covers { flex: none; min-height: 300px; }
  .cover { width: min(46%, 300px); }

  /* experience full width, contact + resume side by side */
  .exp-cell { flex-basis: 100%; }
  .side-col { flex-direction: row; flex-basis: 100%; }
  .side-col > .cell { flex: 1 1 0; }
  .contact { min-height: 240px; }
  .cv { flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 24px; }

  .research { grid-template-columns: 1fr 1fr; }

  .page-head { padding: 112px 0 40px; }
  .project-card { grid-template-columns: 1fr 1fr; }
  .project-card .body { padding: 8px; gap: 20px; }
  .detail-head { padding: 72px 0 40px; }
  .detail-cover { aspect-ratio: 16 / 11; }
}

/* Phone tweaks */
@media (max-width: 639px) {
  [data-reveal] { transform: translateY(20px); transition-duration: .6s; }
  .hero { padding: 40px 0 96px; }
  /* bigger avatar so the first screen feels full; scales with screen height too */
  .hero { gap: 24px; justify-content: center; }
  .hero-avatar { width: clamp(176px, min(68vw, 30svh), 300px); height: auto; aspect-ratio: 1; }
  .hero-lead { font-size: 16px; line-height: 24px; }
  .hero-down { display: none; }  /* the tab bar already leads the way on phones */
  .intro {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "about  about"
      "skills skills"
      "li     be";
  }
  .about { gap: 20px; }
  .skills { gap: 14px; }
  .skills-title { font-size: 26px; }
  .pill { padding: 7px 12px; font-size: 12px; line-height: 16px; }
  .social { min-height: 96px; }
  .social .glyph { font-size: 28px; }
  .contact { min-height: 232px; }
  .contact .star { right: -16px; top: 28px; width: 88px; height: 88px; font-size: 88px; }
  .contact .connect { font-size: 26px; }
  .exp-item, .exp-early .line { grid-template-columns: 1fr; gap: 4px; }
  .exp-item { padding: 12px; }
  .modal { align-items: flex-end; padding: 8px; }
  .modal-box { max-height: calc(100dvh - 16px); border-radius: 24px; }
  .modal-head h3 { font-size: 26px; }
}

/* short phones (e.g. iPhone SE): tighten the first screen so nothing hides behind the tab bar */
@media (max-width: 639px) and (max-height: 720px) {
  .hero { gap: 18px; padding: 32px 0 88px; }
}
