/* Portfolio — editorial, architecture-informed design system */

:root {
  --bg: #f7f8fa;
  --ink: #1a1a1a;
  --soft: #333333;
  --muted: #666666;
  --accent: #2440d0;
  --hairline: rgba(26, 26, 26, 0.14);
  --ph-bg: #ecebe4;
  --serif: "Playfair Display", "Noto Serif SC", Georgia, serif;
  --sans: "Geist", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --measure: 68ch;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

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

img,
canvas {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

p {
  margin: 0 0 1.25rem;
  max-width: var(--measure);
}

/* ---------- shared structure ---------- */

.container {
  width: min(1120px, 100% - 3rem);
  margin-inline: auto;
}

.display {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
}

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

/* ---------- nav ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 0.85rem;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--soft);
  transition: color 0.25s ease;
}

.nav-links a:hover {
  color: var(--accent);
}

.lang-toggle {
  display: flex;
  gap: 0.35rem;
  border-left: 1px solid var(--hairline);
  padding-left: 1.25rem;
}

.lang-toggle button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0.6rem 0.45rem;
  min-height: 44px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease, text-shadow 0.2s ease;
}

.lang-toggle button[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* bold on hover/selected without shifting the other button (same trick as the resume links) */
.lang-toggle button:hover,
.lang-toggle button:focus-visible,
.lang-toggle button[aria-pressed="true"] {
  color: var(--ink);
  text-shadow: 0.35px 0 0 currentColor, -0.35px 0 0 currentColor;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  min-height: calc(100svh - 61px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#grid-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  padding-block: clamp(4rem, 12vh, 8rem);
}

.hero-name {
  margin: 0 0 1.5rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3rem, 11vw, 8rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
}

.hero-role {
  margin: 0;
  max-width: 42ch;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.65;
  color: var(--soft);
}

.hero-meta {
  position: relative;
  margin-top: clamp(3rem, 10vh, 6rem);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------- work index ---------- */

.work {
  padding-block: clamp(5rem, 12vw, 9rem) clamp(3rem, 8vw, 6rem);
}

.section-title {
  margin: 0 0 clamp(3rem, 8vw, 5.5rem);
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.3rem, 6vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.project {
  padding-block: clamp(3.5rem, 9vw, 7rem);
}

.project:first-of-type {
  padding-top: 0;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: clamp(1.5rem, 3vw, 3rem);
  row-gap: 2rem;
  align-items: end;
}

.project-index {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.project-title {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.project-title a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0% 2px;
  background-position: 0 100%;
  transition: background-size 0.35s ease, color 0.25s ease;
}

.project-title a:hover {
  background-size: 100% 2px;
}

.project-desc {
  margin: 0 0 1rem;
  color: var(--soft);
  max-width: 44ch;
}

.project-meta {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.case-link {
  font-size: 0.95rem;
  color: var(--ink);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 0.2rem;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.case-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* media placeholders */
.ph {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--ph-bg);
  border: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
  padding: 1rem;
}

.ph-tall {
  aspect-ratio: 4 / 5;
}

/* layout variants */
.project--a .project-text {
  grid-column: 1 / 6;
}

.project--a .project-media {
  grid-column: 7 / 13;
}

.project--b .project-media {
  grid-column: 1 / -1;
}

.project--b .project-text {
  grid-column: 2 / 8;
  margin-top: -4rem;
  position: relative;
}

.project--c .project-media {
  grid-column: 1 / 8;
}

.project--c .project-text {
  grid-column: 9 / 13;
}

.project--d .project-text {
  grid-column: 3 / 11;
}

.project--d .project-media {
  grid-column: 1 / -1;
}

/* ---------- about ---------- */

.about {
  padding-block: clamp(4rem, 10vw, 8rem);
}

.about .section-title {
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.about-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: clamp(1.5rem, 3vw, 3rem);
  padding-block: 1.75rem;
  border-top: 1px solid var(--hairline);
}

.about-row dt {
  grid-column: 1 / 4;
  font-size: 0.875rem;
  color: var(--muted);
  padding-top: 0.3rem;
}

.about-row dd {
  grid-column: 4 / 11;
  margin: 0;
  color: var(--soft);
}

.about-row dd p {
  margin-bottom: 0;
}

/* ---------- footer / contact ---------- */

.contact {
  padding-block: clamp(5rem, 14vw, 10rem) 2rem;
}

.contact-title {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 8vw, 6rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.contact-title a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0% 3px;
  background-position: 0 100%;
  transition: background-size 0.4s ease;
}

.contact-title a:hover {
  background-size: 100% 3px;
}

.contact-mail {
  color: var(--muted);
  font-size: 1.05rem;
}

.foot-bar {
  margin-top: clamp(4rem, 10vw, 7rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------- case detail pages ---------- */

.case-main {
  padding-block: clamp(3.5rem, 9vw, 7rem) clamp(4rem, 10vw, 8rem);
}

.case-hero {
  margin-bottom: clamp(3rem, 8vw, 5rem);
}

.case-kicker {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.case-title {
  margin: 0 0 1.25rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.case-subtitle {
  margin: 0;
  max-width: 52ch;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--soft);
}

.case-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem 2rem;
  margin: 0 0 clamp(3rem, 8vw, 5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
}

.case-meta dt {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.case-meta dd {
  margin: 0;
  font-size: 0.95rem;
}

.case-section {
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.case-section h2 {
  margin: 0 0 1.25rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  line-height: 1.15;
}

.case-section .prose {
  color: var(--soft);
}

.case-media {
  margin-block: clamp(2rem, 5vw, 3.5rem);
}

.case-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 2.5vw, 2rem);
}

.next-case {
  display: block;
  margin-top: clamp(3rem, 8vw, 6rem);
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
}

.next-case .next-label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.next-case .next-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.1;
  transition: color 0.25s ease;
}

.next-case:hover .next-title {
  color: var(--accent);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.95rem;
  color: var(--soft);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 0.15rem;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.back-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.case-nav .container {
  gap: 2rem;
}

/* ---------- motion ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

.fade-img {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.fade-img.loaded {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .fade-img {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- responsive ---------- */

@media (max-width: 820px) {
  .project-grid,
  .about-row {
    display: block;
  }

  .project-text {
    margin-bottom: 2rem;
  }

  .project--b .project-text {
    margin-top: 0;
  }

  .project {
    padding-block: 3.5rem;
  }

  .about-row dt {
    margin-bottom: 0.5rem;
  }

  .about-row dd {
    margin-bottom: 0.5rem;
  }

  .case-media-grid {
    grid-template-columns: 1fr;
  }

  .nav-links {
    gap: 1.1rem;
  }

  .lang-toggle {
    padding-left: 0.9rem;
  }
}

/* sharp pass */
:root {
  --mono: "Geist Mono", "SFMono-Regular", Consolas, monospace;
}

body {
  font-weight: 400;
}

.display,
.hero-name,
.section-title,
.project-title,
.contact-title,
.case-title,
.next-title {
  font-weight: 800;
}

.wordmark {
  font-weight: 700;
  font-size: 1.05rem;
}

.coord {
  position: absolute;
  z-index: 2;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.coord--tl {
  top: 1.4rem;
  left: clamp(1.25rem, 4vw, 3.5rem);
}

.coord--bl {
  bottom: 1.4rem;
  left: clamp(1.25rem, 4vw, 3.5rem);
}

.hero-inner {
  width: min(1120px, 100% - 3rem);
  margin-inline: auto;
  padding-left: clamp(2rem, 10vw, 9rem);
  padding-block: clamp(6rem, 16vh, 10rem) clamp(5rem, 12vh, 8rem);
}

.hero-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.project-rule {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--hairline);
  padding-top: 0.65rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.project--a .project-media {
  margin-top: clamp(2.5rem, 7vw, 6rem);
}

.project--a .project-text {
  padding-top: clamp(0.5rem, 2vw, 1.5rem);
}

@media (max-width: 820px) {
  .hero-inner {
    padding-left: 2.25rem;
  }
}

.wordmark {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .container {
    width: calc(100% - 1.5rem);
  }

  .nav-links {
    gap: 0.9rem;
  }

  .nav-links a {
    min-height: 40px;
    font-size: 0.92rem;
  }

  .lang-toggle {
    padding-left: 0.6rem;
  }

  .lang-toggle button {
    padding: 0.5rem 0.3rem;
    min-height: 40px;
  }
}

/* project structure pass */
.project-rule {
  border-top: 1px solid rgba(26, 26, 26, 0.1);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

.project-rule--first {
  border-top: 0;
  padding-top: 0;
}

.project--a .project-grid,
.project--b .project-grid {
  align-items: start;
}

.project--a .project-text {
  grid-column: 1 / 6;
  padding-top: 0;
}

.project--a .project-media {
  grid-column: 6 / 13;
  margin-top: 0;
}

.project--b .project-media {
  grid-column: 1 / 8;
  margin-top: 0;
}

.project--b .project-text {
  grid-column: 8 / 13;
  margin-top: 0;
  position: static;
}

.project-title {
  font-size: clamp(2rem, 3.2vw, 2.5rem);
}

.project-desc {
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  max-width: 40ch;
}

.project-meta {
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.art {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #e9e7df;
}

.art::before {
  content: "";
  position: absolute;
  width: 62%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: #dcd9cd;
  right: -12%;
  top: -16%;
}

.art::after {
  content: "";
  position: absolute;
  width: 32%;
  aspect-ratio: 3 / 4;
  left: 9%;
  bottom: 12%;
  background: rgba(26, 26, 26, 0.05);
  border: 1px solid rgba(26, 26, 26, 0.2);
}

/* flower marker + custom cursor */
.name-mark {
  position: relative;
  display: inline-block;
}

.flower {
  position: absolute;
  top: -16px;
  right: -60px;
  width: 48px;
  height: 48px;
  animation: flower-spin 10s linear infinite;
}

.flower svg {
  display: block;
  width: 100%;
  height: 100%;
}

.flower:hover {
  animation-duration: 2.5s;
}

@keyframes flower-spin {
  to {
    transform: rotate(360deg);
  }
}

.cursor-dot {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 999;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a7f4b;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: width 0.2s ease, height 0.2s ease, opacity 0.2s ease;
}

.cursor-dot.is-active {
  width: 22px;
  height: 22px;
}

html.has-cursor,
html.has-cursor * {
  cursor: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .flower {
    animation: none;
  }
}

@media (hover: none) {
  html.has-cursor,
  html.has-cursor * {
    cursor: auto !important;
  }

  .cursor-dot {
    display: none;
  }
}

/* interaction pass */
.flower {
  top: -18px;
  right: -68px;
  width: 54px;
  height: 54px;
}

.cursor-dot {
  width: 16px;
  height: 16px;
}

.cursor-dot.is-active {
  width: 28px;
  height: 28px;
}

.nav-links a:hover {
  color: var(--ink);
  font-weight: 700;
}

.case-link:hover {
  color: var(--ink);
  border-color: var(--ink);
  font-weight: 700;
}

.back-link:hover {
  color: var(--ink);
  border-color: var(--ink);
  font-weight: 700;
}

.project-title a {
  background-image: linear-gradient(var(--ink), var(--ink));
}

.project-title a:hover {
  font-weight: 900;
}

.next-case:hover .next-title {
  color: var(--ink);
  font-weight: 900;
}

.contact-title a {
  background-image: linear-gradient(var(--ink), var(--ink));
}

/* project card with a real cover image (16:9) instead of the placeholder art */
.art--img {
  display: block;
  aspect-ratio: 16 / 9;
  background: none;
}

.art--img::before,
.art--img::after {
  content: none;
}

.art--img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.art--img:hover img {
  opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
  .art--img img {
    transition: none;
  }
}

/* "View case": no underline, a right arrow after the label instead */
.case-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  border-bottom: 0;
  padding-bottom: 0;
}

.case-link::after {
  content: "→";
  font-weight: 400;
}

/* phones: the full name runs close to the right edge, so tuck the flower in */
@media (max-width: 600px) {
  .flower {
    top: -12px;
    right: -30px;
    width: 30px;
    height: 30px;
  }
}

/* About row that links out: the whole row is clickable, an arrow appears on
   the right end on hover / keyboard focus */
.about-row--link {
  position: relative;
}

.about-row-link {
  position: static;
}

.about-row-link::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.about-row-arrow {
  position: absolute;
  right: 0;
  top: 50%;
  translate: 0 -50%;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.about-row--link:hover .about-row-arrow,
.about-row-link:focus-visible .about-row-arrow {
  opacity: 1;
}

.about-row-link:focus-visible {
  outline: none;
}

.about-row--link:has(.about-row-link:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* touch screens have no hover: keep the arrow visible so the link is findable */
@media (hover: none) {
  .about-row-arrow {
    opacity: 1;
  }
}

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

@media (max-width: 820px) {
  .about-row--link dd {
    padding-right: 2rem;
  }
}

/* covers with a white background: multiply so the white takes on the page colour */
.art--blend img {
  mix-blend-mode: multiply;
}

/* case pages: "Back" without an underline */
.back-link {
  border-bottom: 0;
  padding-bottom: 0;
}

/* resume links under the contact email: both languages always shown */
.contact-links {
  margin: 0.6rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  color: var(--muted);
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  color: var(--ink);
  transition: text-shadow 0.2s ease;
}

.contact-links a::after {
  content: "↗";
  font-size: 0.9em;
}

/* bold on hover without shifting the neighbouring link (the page loads only the 400 weights) */
.contact-links a:hover,
.contact-links a:focus-visible {
  color: var(--ink);
  text-shadow: 0.35px 0 0 currentColor, -0.35px 0 0 currentColor;
}

/* tighter vertical rhythm on the homepage: less space between sections and projects */
.work {
  padding-block: clamp(3.5rem, 8vw, 6rem) clamp(2rem, 5vw, 3.5rem);
}

.section-title {
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.project {
  padding-block: clamp(2rem, 5vw, 3.75rem);
}

.project:first-of-type {
  padding-top: 0;
}

.project-rule {
  margin-bottom: clamp(1.25rem, 3vw, 2.25rem);
}

.project--a .project-media {
  margin-top: clamp(1rem, 3vw, 2.5rem);
}

.about {
  padding-block: clamp(3rem, 7vw, 5.5rem);
}

.contact {
  padding-block: clamp(3.5rem, 9vw, 6.5rem) 2rem;
}
