/* ==========================================================================
   Elaine Liman — portfolio
   ========================================================================== */

:root {
  --cream: #f6f3ed;      /* header + light sections */
  --stone: #e6e2db;      /* default page background */
  --ink: #292929;        /* text + dark sections */
  --peach: #eea175;      /* accent */
  --mist: #c4d2db;       /* light text on dark */
  --taupe: #807c74;      /* muted headings */
  --grey: #909090;
  --white: #fafafa;

  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --maxw: 1000px;
  --gutter: clamp(16px, 4vw, 40px);
  --side-w: 220px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: var(--stone);
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

h1, h2, h3, h4 { font-weight: 400; margin: 0 0 0.4em; }

h1, h2 {
  font-size: clamp(42px, 5.3vw, 68px);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

h3 {
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: 0.5em; }
li p { margin: 0; }

blockquote {
  margin: 0 0 1em;
  padding-left: 1em;
  border-left: 2px solid var(--peach);
  font-style: italic;
}

.label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.6em;
}

/* Hand-drawn style highlight underline */
.hl {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 8' preserveAspectRatio='none'%3E%3Cpath d='M1 5.5C40 2.5 90 2 199 4' stroke='%23eea175' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 0.35em;
  background-position: 0 100%;
  padding-bottom: 0.12em;
  text-decoration: none;
}
.hl a { text-decoration: none; }
.hl--blue, .case--blue .hl {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 8' preserveAspectRatio='none'%3E%3Cpath d='M1 5.5C40 2.5 90 2 199 4' stroke='%23c4d2db' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

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

.container {
  width: 100%;
  max-width: calc(var(--maxw) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.container.narrow { max-width: calc(900px + var(--gutter) * 2); }

.section { padding: clamp(56px, 8vw, 84px) 0; }
.section--cream { background: var(--cream); }
.section--stone { background: var(--stone); }
.section--dark { background: var(--ink); color: var(--stone); }
.section--dark h2 { color: var(--peach); }
.section--dark .muted-heading { color: var(--mist); }

.muted-heading { color: var(--taupe); }

.grid { display: grid; gap: clamp(24px, 4vw, 48px); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); }

.stack > * + * { margin-top: 24px; }
.mt-lg { margin-top: clamp(40px, 6vw, 64px); }
.center { text-align: center; }

@media (max-width: 800px) {
  .grid-2, .grid-3, .grid-4, .grid-1-2, .grid-2-1, .grid-1-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--side-w);
  z-index: 50;
  background: var(--cream);
  border-right: 1px solid rgba(41,41,41,0.08);
}
.sidebar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 32px 28px 28px;
  overflow-y: auto;
}
.sidebar-menu { flex: 1; display: flex; flex-direction: column; }
.logo { display: inline-block; }
.logo img { width: 160px; height: auto; }

.side-nav { margin-top: 48px; }
.side-nav ul { list-style: none; margin: 0 0 24px; padding: 0; }
.side-nav li { margin: 0; }
.side-nav a {
  display: block;
  padding: 4px 0;
  font-size: 17px;
  color: var(--taupe);
  text-decoration: none;
  transition: color 0.15s;
}
.side-nav a:hover { color: var(--ink); }
.side-nav a[aria-current] { color: var(--ink); }
.side-nav .back { margin-bottom: 20px; color: var(--ink); }
.side-nav .back span { display: inline-block; transition: transform 0.15s; }
.side-nav .back:hover span { transform: translateX(-3px); }
.toc a[aria-current] { color: var(--peach); }

.sidebar .socials { margin-top: auto; justify-content: flex-start; }
.sidebar .socials a { color: var(--ink); }
.sidebar .socials a:hover { color: var(--peach); }

body > main { margin-left: var(--side-w); }

.socials { display: flex; justify-content: center; gap: 14px; }
.socials a { display: inline-flex; color: var(--ink); }
.socials svg { width: 20px; height: 20px; fill: currentColor; }

.btn {
  display: inline-block;
  border: 1px solid var(--ink);
  border-radius: 300px;
  padding: 0.5em 1.5em;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, color 0.2s;
}
.btn:hover { background: var(--ink); color: var(--cream); }
.section--dark .btn { border-color: var(--stone); color: var(--stone); }
.section--dark .btn:hover { background: var(--stone); color: var(--ink); }

.menu-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 8px;
  margin-left: auto;
  cursor: pointer;
}
.menu-toggle span { display: block; width: 26px; height: 2px; background: var(--ink); margin: 6px 0; transition: transform 0.2s, opacity 0.2s; }

/* Below 900px the sidebar becomes a top bar with a drop-down menu */
@media (max-width: 900px) {
  :root { --side-w: 0px; }
  html { scroll-padding-top: 72px; }
  .sidebar { position: sticky; bottom: auto; width: auto; border-right: 0; border-bottom: 1px solid rgba(41,41,41,0.08); }
  .sidebar-inner { padding: 0 16px; overflow: visible; }
  .sidebar-top { height: 72px; display: flex; align-items: center; }
  .logo img { width: 150px; }
  .menu-toggle { display: block; }
  .sidebar-menu { display: none; }
  .sidebar.open .sidebar-menu {
    display: flex;
    position: absolute;
    top: 72px; left: 0; right: 0;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    background: var(--cream);
    padding: 8px 16px 28px;
    border-bottom: 1px solid rgba(41,41,41,0.08);
  }
  .side-nav { margin-top: 0; }
  .side-nav a { font-size: 22px; padding: 6px 0; }
  .sidebar .socials { margin-top: 8px; }
  .sidebar.open .menu-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .sidebar.open .menu-toggle span:nth-child(2) { opacity: 0; }
  .sidebar.open .menu-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}

/* ---------- Home ---------- */

.hero { display: grid; grid-template-columns: 150px minmax(0, 600px); gap: 50px; align-items: start; }
.hero .avatar { width: 146px; height: 146px; border-radius: 50%; object-fit: cover; }
.hero .intro { font-size: 21px; line-height: 1.2; }
.hero h2 { margin: 0.25em 0 0.3em; }
@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero .avatar { width: 110px; height: 110px; }
}

.peek { margin-top: 70px; font-size: clamp(28px, 3.5vw, 44px); }

.home { position: relative; overflow: hidden; }
.home > .container { position: relative; z-index: 1; }
.blob {
  position: absolute;
  top: 0; left: 0;
  width: 640px; height: 640px;
  margin: -320px 0 0 -320px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(238,161,117,0.6), rgba(238,161,117,0) 100%);
  filter: blur(20px);
  pointer-events: none;
  will-change: transform;
}
.cases { position: relative; margin-top: 36px; }
.case {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr);
  align-items: center;
  margin-bottom: 70px;
}
.case-img {
  display: block;
  border-radius: 24px;
  overflow: hidden;
  background: var(--cream);
  box-shadow: 1px 2px 3px rgba(0,0,0,0.08);
}
.case-img img { width: 100%; transition: transform 0.4s ease; }
.case-img:hover img { transform: scale(1.03); }
.case-card {
  margin-left: -50px;
  position: relative;
  z-index: 2;
  background: var(--ink);
  color: var(--stone);
  border-radius: 24px;
  padding: 32px 36px 36px;
  box-shadow: 1px 2px 3px rgba(0,0,0,0.15);
}
.case-card h3 { margin: 0.4em 0 0.5em; }
.case-card a { text-decoration: none; color: var(--stone); }

/* Highlights draw in when the card scrolls into view */
.case .hl { background-size: 0 0.35em; transition: background-size 0.8s cubic-bezier(0.65,0,0.35,1) 0.3s; }
.case.in .hl { background-size: 100% 0.35em; }

/* Hand-drawn circle around "Learn More" */
.case-card .more { position: relative; display: inline-block; margin-top: 0.6em; padding: 0 2px; }
.case-card .circle {
  position: absolute;
  inset: -9px -14px -9px -14px;
  width: calc(100% + 28px);
  height: calc(100% + 18px);
  overflow: visible;
  pointer-events: none;
}
.case-card .circle path {
  fill: none;
  stroke: var(--peach);
  stroke-width: 2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.case--blue .circle path { stroke: var(--mist); }
.case:hover .circle path, .case-card .more:focus-visible .circle path { animation: circle-draw 0.8s cubic-bezier(0.65,0,0.35,1); }
@keyframes circle-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .case .hl { transition: none; }
  .case-card .circle path { animation: none !important; }
}
@media (max-width: 1000px) {
  .case { grid-template-columns: 1fr; }
  .case-card { margin: -40px 20px 0; }
}

/* ---------- Case study ---------- */

.meta { border-top: 1px solid rgba(41,41,41,0.25); padding-top: 24px; margin-top: 24px; }
.meta p { margin: 0; }
.figure-note { color: var(--grey); font-size: 15px; }

.media-frame { border-radius: 4px; overflow: hidden; }
.decision { align-items: start; }
.decision + .decision { margin-top: 64px; }
.zoomable { cursor: zoom-in; }

.embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #000;
}
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.full-banner { height: clamp(260px, 50vw, 720px); background-size: cover; background-position: center; }

.takeaways-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.takeaways-split .side-img { background-size: cover; background-position: center; min-height: 320px; }
@media (max-width: 800px) { .takeaways-split { grid-template-columns: 1fr; } }

/* ---------- Graphics ---------- */

.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
@media (max-width: 700px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

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

.role-title { font-size: 21px; margin-bottom: 0.5em; }
.role-meta { margin: 0; }
.role-meta .when { color: var(--taupe); }
.rule { border: 0; border-top: 1px solid rgba(41,41,41,0.25); margin: 48px 0; }
.edu-name { font-size: 19px; margin-bottom: 0.5em; }


/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20,20,20,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  overflow: auto;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: min(1400px, 100%); max-height: none; margin: auto; }
.lightbox .close {
  position: fixed;
  top: 16px; right: 20px;
  background: none; border: 0;
  color: #fff; font-size: 36px; line-height: 1;
  cursor: pointer;
}

/* ---------- Reveal on scroll ---------- */

.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.65s cubic-bezier(0.19,1,0.22,1), transform 0.65s cubic-bezier(0.19,1,0.22,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Graphics project pages ---------- */

.project-cover img { width: 100%; }
.project-title { margin-bottom: 0.3em; color: var(--mist); }
.project-date { margin-bottom: 0.2em; }
.project-stack { display: grid; gap: 24px; }
.project-strips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.project-strips img { width: 100%; }
@media (max-width: 700px) { .project-strips { grid-template-columns: 1fr; } }
.project-strips img:first-child:nth-last-child(odd) { grid-column: 1 / -1; }

.project-pagination {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 56px;
  font-size: clamp(20px, 2.2vw, 26px);
  letter-spacing: -0.02em;
}
.project-pagination a { color: var(--stone); text-decoration: none; }
.project-pagination a:hover { color: var(--peach); }
.project-pagination .next { text-align: right; margin-left: auto; }

/* Light (beige) project pages and intros */
.section--stone, .section--cream { color: var(--ink); }
.section--stone .project-title, .section--cream .project-title { color: var(--taupe); }
.project--light .project-pagination a { color: var(--ink); }
.project--light .project-pagination a:hover { color: var(--peach); }

/* Centred intro, as on Senja Eatery */
.project-intro { max-width: calc(600px + var(--gutter) * 2); text-align: center; }
.project-intro p:last-child { font-size: 21px; line-height: 1.2; margin-top: 24px; }

/* "Strips" gallery: full-width rows where every image in a row is the same height */
.strips { background: var(--ink); padding: 38px; }
.strip-row { display: flex; gap: var(--gap, 20px); }
.strip-row + .strip-row { margin-top: var(--gap, 20px); }
.strip-row img { flex: var(--r) 1 0; width: 0; min-width: 0; aspect-ratio: var(--r); object-fit: cover; }
@media (max-width: 700px) {
  .strips { padding: 16px; }
  .strip-row { flex-direction: column; }
  .strip-row img { width: 100%; flex: none; }
}

/* Gallery tiles link to project pages, with the title shown on hover */
.gallery a { position: relative; display: block; aspect-ratio: 1; overflow: hidden; color: #fff; text-decoration: none; }
.gallery a:hover img { transform: scale(1.03); }
.gallery a:focus-visible { outline: 2px solid var(--peach); outline-offset: 2px; }
.gallery .tile-title {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -0.03em;
  color: var(--ink);
  background: rgba(230,226,219,0.75);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gallery a:hover .tile-title, .gallery a:focus-visible .tile-title { opacity: 1; }
@media (hover: none) {
  .gallery .tile-title { opacity: 1; inset: auto 0 0 0; background: rgba(230,226,219,0.85); font-size: 18px; justify-content: flex-start; }
}

