/* =========================================================================
   Ihsan Duru — portfolio
   Everything is plain CSS; edit freely. The banner is the only elaborate
   part and it's commented where the tricks are.
   ========================================================================= */

/* Inter Display — SIL Open Font License */
@font-face {
  font-family: "Inter Display";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter-display-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2122, U+2212;
}
@font-face {
  font-family: "Inter Display";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter-display-700-ext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ink: #ffffff;
  --ink-dim: #8a8a8a;
  --paper: #000000;
  --panel: #101012;
  --line: #24242a;
  --accent: #4f6bff;
  --sans: "Inter Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --pad: clamp(20px, 5vw, 72px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

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

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: #fff; color: #000; padding: 10px 16px;
}
.skip:focus { left: 8px; top: 8px; }

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

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--pad);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  /* Difference alone adapts: white on black stays white, white on the bright
     halftone comes out black. The invert that used to be here cancelled it to
     black-on-black and made the nav invisible on the dark banner. */
  mix-blend-mode: difference;
  pointer-events: none;
}
.nav a { pointer-events: auto; text-decoration: none; }
.nav__links { display: flex; gap: clamp(18px, 4vw, 56px); }
.nav__links a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- banner ------------------------------------------------------- */

.banner {
  position: relative;
  height: 100vh;
  /* svh is the viewport with the browser chrome showing - without this the
     bottom of the banner sits behind the address bar on a phone */
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: var(--paper);
  /* driven by main.js on scroll */
  --drift: 0px;
  --flash: 1;
}

.banner__halftone,
.banner__texture,
.banner__flash,
.banner__portrait {
  position: absolute;
  pointer-events: none;
  will-change: transform;
}

/* the halftone band; its bottom edge is already faded in the file itself */
.banner__halftone {
  left: 0; right: 0; top: 50%;
  height: 37.5vw;
  transform: translateY(-50%);
  background: url("../img/bg-effect-2-faded.png") center / 100% 100% no-repeat;
  /* Fades out before the wordmark's N so the role stack sits on flat black.
     --n-left is measured and set by main.js; the fallback covers first paint. */
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(var(--n-left, 72%) - 20%), transparent calc(var(--n-left, 72%) - 2%));
  mask-image: linear-gradient(to right, #000 0%, #000 calc(var(--n-left, 72%) - 20%), transparent calc(var(--n-left, 72%) - 2%));
  z-index: 0;
}

/* retired: the texture was pulled out of the background */
.banner__texture {
  display: none;
  right: -50vh; top: 50%;
  width: 100vh; height: 100vh;
  transform: translateY(-50%) translateY(var(--drift));
  background: url("../img/right-stroke.png") center / contain no-repeat;
  z-index: 1;
}

/* 8x8 sprite sheet, 64 frames, stepped entirely in CSS.
   With background-size:800%, a percentage position maps across
   (element − image), so column k sits at k/7 of the range — running to
   114.2857% (8/7) in steps(8) lands exactly on columns 0–7. */
@keyframes flash-col { from { background-position-x: 0%; } to { background-position-x: 114.2857%; } }
@keyframes flash-row { from { background-position-y: 0%; } to { background-position-y: 114.2857%; } }

.banner__flash {
  left: 50%; top: 33%;        /* kept on the buttons */
  width: calc(min(72vw, 92vh) * var(--flash));
  height: calc(min(72vw, 92vh) * var(--flash));
  transform: translate(-50%, -50%) translateY(var(--drift));
  background-image: url("../img/wind-vortex.png");
  background-size: 800% 800%;
  background-repeat: no-repeat;
  animation: flash-col 0.3s steps(8) infinite, flash-row 2.4s steps(8) infinite;
  transition: width 0.25s ease, height 0.25s ease;
  opacity: 0.85;
  z-index: 1;
}

/* the stroke is baked into each portrait file's alpha — masking live cost a
   compositing pass on every scroll frame. main.js swaps the file. */
/* `isolation: isolate` gives this group its own stacking context, so the
   wordmark's blend reaches the portrait inside it and not the halftone below. */
.banner__stage {
  position: absolute;
  inset: 0;
  isolation: isolate;
  pointer-events: none;
  z-index: 2;
}

.banner__portrait {
  left: 1vw;
  bottom: calc(16px + 3vw);
  width: min(48vw, 66vh);
  height: min(48vw, 66vh);
  background: url("../img/portrait-stroke-5.png") center / contain no-repeat;
  transform: translateY(var(--drift));
  z-index: 2;
}

/* main.js measures where the N of IHSAN starts and sets these, so the stack
   spans from that letter to the right margin and sits on the cap line. */
.banner__roles {
  position: absolute;
  right: 1.5vw;
  bottom: var(--roles-bottom, calc(16px + 30vw));
  margin: 0; padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.8vw;
  font-size: var(--roles-size, min(9vw, 12vh, 7.5rem));
  /* A serif against the heavy wordmark. Deliberately a system stack: the face
     used while designing this was a trial cut of a commercial font and is not
     licensed for a live site. Swap in a licensed webfont here when you have one. */
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: 400;
  line-height: 0.82;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: #fff;
  /* the texture holds both near-white and near-black, so a flat colour
     disappears on one or the other; outline survives both */
  -webkit-text-stroke: 0.07vw #000;
  paint-order: stroke fill;
  text-shadow: 0 0.3vw 1.2vw rgba(0, 0, 0, 0.55);
  transform: translateY(var(--drift));
  pointer-events: none;
  z-index: 4;
  /* held back until the stack has been measured, so it doesn't visibly resize */
  opacity: 0;
}

.banner.is-fitted .banner__roles { opacity: 1; }

/* Entrance: each line eases in from the right, one after the next, once the
   stack has been measured. `backwards` holds the from-state through the delay
   and — crucially — releases the element to its normal styles afterwards, so
   the hover transform below still works. `forwards` would pin the transform
   and kill it. */
@keyframes role-in {
  from { opacity: 0; transform: translateX(1.4vw); }
  to   { opacity: 1; transform: translateX(0); }
}

.banner__roles li {
  pointer-events: auto;
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.4s ease, text-shadow 0.4s ease;
}

.banner.is-fitted .banner__roles li {
  animation: role-in 0.75s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
}
.banner.is-fitted .banner__roles li:nth-child(1) { animation-delay: 0.10s; }
.banner.is-fitted .banner__roles li:nth-child(2) { animation-delay: 0.26s; }
.banner.is-fitted .banner__roles li:nth-child(3) { animation-delay: 0.42s; }
.banner__roles li:hover {
  transform: translateX(-1.6vw);
  text-shadow: 0 0 1.6vw rgba(255, 255, 255, 0.5), 0 0.3vw 1.2vw rgba(0, 0, 0, 0.65);
}
.banner__roles:hover li:not(:hover) { opacity: 0.4; }

/* white wordmark under `exclusion`: white on black stays white, and where the
   letters cross the artwork the colours invert */
.banner__wordmark {
  position: absolute;
  left: 10px; right: 10px; bottom: 16px;
  font-size: 33.1vw;          /* tuned so IHSAN spans the full width */
  font-weight: 700;
  line-height: 0.73;
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  color: #fff;
  mix-blend-mode: exclusion;
  transform: translateY(var(--drift));
  pointer-events: none;
  z-index: 3;
}

.banner__cta {
  position: absolute;
  left: 50%; top: 33%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1vw;
  transform: translate(-50%, -50%) translateY(var(--drift));
  z-index: 5;
}

/* Buttons fade in behind the lines - no slide, as asked. Opacity only, so it
   never fights the translateY on :hover. */
@keyframes btn-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.banner__cta .btn {
  animation: btn-in 0.8s ease backwards;
}
.banner__cta .btn:nth-child(1) { animation-delay: 0.58s; }
.banner__cta .btn:nth-child(2) { animation-delay: 0.72s; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14vw;
  min-width: 150px;
  height: 4.4vw;
  min-height: 44px;
  white-space: nowrap;
  background: url("../img/button-bg.jpg") center / cover no-repeat;
  background-clip: padding-box;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4),
              inset 0 -3px 8px rgba(0, 0, 0, 0.4),
              0 3px 14px rgba(0, 0, 0, 0.5);
  font-size: clamp(11px, 1.15vw, 15px);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55),
              inset 0 -3px 8px rgba(0, 0, 0, 0.35),
              0 6px 18px rgba(0, 0, 0, 0.55);
}

/* ---------- sections ----------------------------------------------------- */

.section {
  padding: clamp(64px, 12vh, 160px) var(--pad);
  border-top: 1px solid var(--line);
}

.section__head { margin-bottom: clamp(28px, 5vh, 64px); }
.section__head h2 {
  margin: 0;
  font-size: clamp(32px, 6vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.03em;
}
.section__note {
  margin: 12px 0 0;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(20px, 3vw, 40px);
}

.card__cover {
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--cover, #222), #000 78%);
  border: 1px solid var(--line);
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.card:hover .card__cover { transform: translateY(-6px); }
.card__title { margin: 18px 0 6px; font-size: 20px; letter-spacing: -0.01em; }
.card__meta {
  margin: 0 0 10px;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.card__text { margin: 0; color: #b9b9c0; font-size: 15px; line-height: 1.6; }

.section--split { display: grid; gap: clamp(24px, 4vw, 72px); }
@media (min-width: 900px) { .section--split { grid-template-columns: 1fr 1.4fr; } }

.prose { max-width: 62ch; }
.lede { margin: 0 0 18px; font-size: clamp(20px, 2.4vw, 30px); line-height: 1.35; letter-spacing: -0.01em; }
.prose p { color: #b9b9c0; font-size: 16px; line-height: 1.75; }

.facts { margin: 32px 0 0; display: grid; gap: 14px; }
.facts > div { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.facts dt { color: var(--ink-dim); font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.facts dd { margin: 0; font-size: 15px; }

.contact__email { margin: 0 0 24px; font-size: clamp(22px, 3.4vw, 44px); letter-spacing: -0.02em; }
.contact__email a { text-decoration: none; border-bottom: 2px solid var(--accent); }
.contact__email a:hover { color: var(--accent); }
.contact__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 22px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }

.foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 28px var(--pad) 40px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- phones ------------------------------------------------------- */
/* The banner assumes width to spread into; in a narrow column it gets
   restacked — roles up top, portrait large and bled off the left. */

@media (max-width: 700px) {
  .banner__roles {
    right: 4vw;
    bottom: auto;
    top: 14vh;
    font-size: min(24vw, 12vh);
    line-height: 0.92;
    gap: 4.5vw;
    -webkit-text-stroke-width: 0.18vw;
  }
  /* the wordmark stays pinned to the bottom edge at any ratio - no vh override */
  .banner__portrait { display: none; }
  .banner__flash {
    top: 70%;
    width: calc(min(120vw, 55vh) * var(--flash));
    height: calc(min(120vw, 55vh) * var(--flash));
  }
  .banner__cta { top: 70%; }
  .btn { width: 46vw; height: 13vw; min-height: 40px; }
  .foot__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .banner__flash { animation: none; }
  .banner__roles li, .card__cover, .btn { transition: none; }
  .banner.is-fitted .banner__roles li, .banner__cta .btn { animation: none; }
}
