/* Görkem Kalafat — Works (My Site 4 design language) */
:root {
  --bg: #dbdbdb;
  --ink: #000;
  --ink-2: #3c3c3c;
  --line: #000;
  --max: 1760px;
  --m: clamp(18px, 10vw, 190px);         /* outer margin: generous air either side */
  --g: clamp(8px, 1.05vw, 17px);         /* tile gap */
  --cols: 4;
  --ease: cubic-bezier(.22, .61, .21, 1);
  --display: "Anton", "Impact", "Haettenschweiler", "Arial Narrow Bold", sans-serif;
  --text: "Jost", "Futura", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  position: relative;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--m); top: 8px; background: #000; color: #fff; padding: 6px 10px; z-index: 10; }

/* ---------- Header ---------- */
.head {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 48px) var(--m) clamp(26px, 3.4vw, 54px);
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 1.6vw, 26px);
}
.head__slash {
  flex: none;
  width: clamp(24px, 3.3vw, 54px);
  height: auto;
  aspect-ratio: 54 / 180;
  margin-bottom: clamp(-26px, -1.9vw, -8px);
  overflow: visible;
}
.head__slash line { stroke: var(--ink); stroke-width: 5; stroke-linecap: butt; vector-effect: non-scaling-stroke; }
@media (min-width: 900px) { .head__slash line { stroke-width: 6; } }
.head__title {
  margin: 0;
  font: 400 clamp(70px, 10.1vw, 166px)/.8 var(--display);
  letter-spacing: -.005em;
  text-transform: none;
}
.head__sign { flex: none; margin-bottom: -.2em; }
.head__sign img { width: clamp(118px, 12.4vw, 204px); height: auto; }
.head__sign p {
  margin: .15em 0 0;
  text-align: right;
  font: 300 clamp(12px, .98vw, 16px)/1 var(--text);
  letter-spacing: .01em;
}
.head__contact {
  margin-left: auto;
  align-self: center;
  font: 400 clamp(15px, 1.3vw, 21px)/1 var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.head__contact:hover { text-decoration-thickness: 2px; }
.head__selected {
  position: absolute;
  right: var(--m);
  bottom: clamp(8px, .75vw, 14px);   /* sits just above the last tile on the right */
  margin: 0;
  font: 300 clamp(12px, .98vw, 16px)/1 var(--text);
  letter-spacing: .01em;
}

/* ---------- Works grid ---------- */
.works {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--m);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;   /* an unfinished last row sits in the middle, as in My Site 4 */
  gap: var(--g);
}
.tile {
  flex: 0 0 calc((100% - (var(--cols) - 1) * var(--g)) / var(--cols));
  min-width: 0;
}
.tile__btn {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0; border: 0; margin: 0;
  background: #c9c9c9;
  overflow: hidden;
  cursor: pointer;
}
.tile__btn img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition: transform .45s var(--ease);
}
.tile__veil {
  position: absolute; inset: 0;
  z-index: 1;
  background: rgba(0,0,0,.4);
  opacity: 0;
  transition: opacity .45s var(--ease);
}
.tile__label {
  position: absolute; inset: 0;
  z-index: 2;
  padding: 12%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: #fff;
  text-align: center;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.tile__name { font: 400 clamp(19px, 1.75vw, 30px)/1.02 var(--display); letter-spacing: .015em; text-wrap: balance; }
.tile__play {
  order: 1;
  flex: none;
  width: 34px; height: 34px;
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 50%;
  display: grid; place-items: center;
}
.tile__play::before {
  content: "";
  margin-left: 2px;
  border-left: 8px solid #fff;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
/* the film grain on each still: under the hover veil, gone while the tile is hovered */
.tile__btn::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='3.2 0 0 0 -1.1 3.2 0 0 0 -1.1 3.2 0 0 0 -1.1 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  opacity: .0484;
  mix-blend-mode: overlay;
  transition: opacity .45s var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .tile__btn:hover::after { opacity: 0; }
  .tile__btn:hover img { transform: scale(1.03); }
  .tile__btn:hover .tile__veil { opacity: 1; }
  .tile__btn:hover .tile__label { opacity: 1; transform: none; }
}
.tile__btn:focus-visible .tile__veil, .tile__btn:focus-visible .tile__label { opacity: 1; transform: none; }
.tile__btn:focus-visible::after { opacity: 0; }

/* muted film preview behind the hover veil */
.tile__preview {
  position: absolute; left: 50%; top: 50%;
  z-index: 0;
  border: 0;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity .5s var(--ease);
}
.tile__preview.is-on { opacity: 1; }
.tile__btn.is-previewing .tile__veil { background: rgba(0,0,0,.3); }

.js-reveal .tile { opacity: 0; transition: opacity .9s var(--ease); }
.js-reveal .tile.is-in { opacity: 1; }

/* ---------- Footer / contact ---------- */
.foot { padding: clamp(56px, 6vw, 96px) var(--m) clamp(26px, 2.6vw, 40px); }
.foot__inner {
  /* same width as the two middle tiles, like My Site 4 */
  width: min(100%, calc((min(100vw, var(--max)) - 2 * var(--m) - 3 * var(--g)) / 2 + var(--g)));
  margin: 0 auto;
}
.foot__info { display: flex; flex-wrap: wrap; gap: 14px clamp(28px, 4.8vw, 80px); margin: 0; }
.foot__info dt { font-size: 14px; margin-bottom: 2px; }
.foot__info dd { margin: 0; font-size: 17px; }
.foot__info a { text-decoration: none; }
.foot__info a:hover { text-decoration: underline; text-underline-offset: 3px; }

.form { margin-top: clamp(64px, 7.5vw, 120px); }
.form__title { margin: 0 0 clamp(24px, 2.6vw, 40px); font: 400 17px/1.2 var(--text); }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 2.4vw, 40px); }
.field { display: block; margin-bottom: clamp(26px, 2.6vw, 38px); }
.field span { display: block; font-size: 15px; margin-bottom: 4px; }
.field input, .field textarea {
  display: block; width: 100%;
  padding: 18px 0 8px;
  border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  outline: none;
  resize: vertical;
}
.field textarea { min-height: 120px; }
.field input:focus, .field textarea:focus { border-bottom-width: 2px; padding-bottom: 7px; }
.field.is-bad span { color: #8a1111; }
.field--msg { grid-column: 1 / -1; }
.field__err { display: block; margin-top: 6px; font-style: normal; font-size: 13px; color: #8a1111; }
.field__err:empty { display: none; }
.form__row:empty { min-height: 240px; }   /* holds the space while the form loads */
.form__error { margin: 0 0 14px; text-align: center; font-size: 14px; color: #8a1111; }
.form__error:empty { display: none; }
.form__send[disabled] { opacity: .55; cursor: progress; }
.form__thanks { margin: 0; font-size: 17px; line-height: 1.5; }
.form__send {
  display: block;
  width: min(100%, 280px);
  margin: 4px auto 0;
  padding: 14px 20px;
  border: 0; border-radius: 0;
  background: #000; color: #fff;
  font-size: 15px; letter-spacing: .02em;
  cursor: pointer;
  transition: background .3s var(--ease);
}
.form__send:hover { background: #2b2b2b; }
.form__note { min-height: 1.4em; margin: 12px 0 0; text-align: center; font-size: 14px; color: var(--ink-2); }

.foot__logo { width: clamp(200px, 19vw, 310px); height: auto; margin: clamp(26px, 3vw, 44px) auto 0; }

/* ---------- Film grain (whole page, scrolls with it; under the film player) ---------- */
.grain {
  position: absolute;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='3.2 0 0 0 -1.1 3.2 0 0 0 -1.1 3.2 0 0 0 -1.1 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  opacity: .16;          /* the softer dose, as it lies on the films */
  mix-blend-mode: overlay;
}
/* a second pass of the same grain under the content: strengthens it on the page only */
.grain--base { z-index: 0; opacity: .1; }
.head, .works, .foot { position: relative; z-index: 1; }
.works { z-index: 61; }   /* tiles carry their own grain, so they sit above the page grain */
/* ---------- Viewer ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 100;
  background: #000; color: #fff;
  display: flex; flex-direction: column;
  opacity: 0;
  transition: opacity .38s var(--ease);
}
.viewer[hidden] { display: none; }
.viewer.is-open { opacity: 1; }
.viewer__bar {
  flex: none;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  height: 64px;
  padding: env(safe-area-inset-top) var(--m) 0;
}
.viewer__title { margin: 0; font-size: 14px; color: #a3a3a3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer__close {
  display: flex; align-items: center; gap: 12px;
  background: none; border: 0; padding: 12px 0 12px 12px;
  font-size: 14px; letter-spacing: .04em; color: #fff; cursor: pointer;
}
.viewer__x { position: relative; width: 14px; height: 14px; }
.viewer__x::before, .viewer__x::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 18px; height: 1px; background: currentColor;
}
.viewer__x::before { transform: translate(-50%, -50%) rotate(45deg); }
.viewer__x::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.viewer__close:hover { color: #bdbdbd; }
.viewer__stage {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 var(--m) calc(64px + env(safe-area-inset-bottom));
}
.viewer__box { position: relative; background: #000; transform: scale(.985); transition: transform .5s var(--ease); }
.viewer.is-open .viewer__box { transform: none; }
.viewer__box iframe, .viewer__box img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: contain; }
.viewer__status {
  position: absolute; left: 0; right: 0; bottom: calc(22px + env(safe-area-inset-bottom));
  margin: 0; text-align: center; font-size: 13px; color: #8a8a8a;
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) { :root { --cols: 3; --m: clamp(18px, 6vw, 60px); } .head__title { font-size: 11.2vw; } .head__sign img { width: 14vw; } }
@media (max-width: 639px) {
  :root { --cols: 2; --m: 18px; --g: 8px; }
  .head { flex-wrap: wrap; align-items: flex-end; row-gap: 14px; position: relative; padding-top: 58px; }
  .head__title { font-size: 27vw; }
  .head__slash { width: 9vw; }
  .head__sign { flex-basis: 100%; display: flex; align-items: flex-end; justify-content: space-between; margin: 0; }
  .head__sign img { width: 150px; }
  .head__sign p { font-size: 13px; }
  .head__contact { position: absolute; top: 20px; right: var(--m); font-size: 15px; }
  .head__sign { display: block; flex-basis: auto; }
  .head__selected { bottom: 6px; font-size: 13px; }
  .tile__label { padding: 10px; gap: 8px; }
  .tile__name { font-size: 17px; }
  .tile__play { width: 26px; height: 26px; }
  .foot__inner { width: 100%; }
  .form__row { grid-template-columns: 1fr; gap: 0; }
  .viewer__bar { height: 56px; }
  .viewer__stage { padding: 0 12px calc(56px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; }
  .js-reveal .tile { opacity: 1; }
}
/* mobile header: signature right-aligned under "Works", "Selected Works" on the left tile edge */
@media (max-width: 639px) {
  .head {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: end;
    column-gap: 10px;
    row-gap: 12px;
  }
  .head__slash { grid-column: 1; grid-row: 1; }
  .head__title { grid-column: 2; grid-row: 1; }
  .head__sign { grid-column: 2; grid-row: 2; justify-self: end; text-align: right; }
  .head__sign img { display: block; margin-left: auto; }
  .head__selected { left: var(--m); right: auto; }
}

/* half the still grain on phones and tablets; the page grain stays */
@media (max-width: 1023px), (hover: none) {
  .tile__btn::after { opacity: .044; }
}
