@import url("fonts.css?v=41");

/* ---------- Base ---------- */
:root {
  --fg: #f3f1ea;                 /* warm off-white, used on the dark VR page  */
  --ink: #14161c;                /* near-black text inside the white windows  */
  --edit-blue: #0048fc;          /* path/selection blue from the frame motif  */
  --edit-blue-deep: #0037bf;
  --anchor: #d9522f;             /* the bézier-handle orange                  */
  --muted: #6b7280;              /* mono labels / captions                    */
  --shadow: rgba(0, 0, 0, 0.55);
  --font-display: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-display);
  color: var(--fg);
  background: #05080d; /* shown until the panorama paints */
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Panorama canvas (background) ---------- */
#pano {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  cursor: grab;
  touch-action: none;          /* let JS own touch gestures (no page scroll) */
}
#pano:active { cursor: grabbing; }
#pano.is-ready { opacity: 1; }

/* Fallback if WebGL is unavailable: show the raw image, centered */
#pano-fallback {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #05080d url("../images/concept_panorama.jpg") center center / cover no-repeat;
}

/* ---------- Top-left title + menu ---------- */
.ui--topleft {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2;
  width: 248px;          /* menu_back.png shown 5% smaller (was 261×286) */
  height: 272px;
  padding: 21px 23px;
  /* The artwork panel (semi-transparent dark with a curved edge). */
  background: url("../images/menu_back.png") top left / 248px 272px no-repeat;
}

.brand {
  margin: 0;
  display: block;
  color: inherit;
  text-decoration: none;
}
.brand__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;       /* tight, wordmark-like */
  line-height: 0.98;
  white-space: nowrap;
  text-shadow: 0 1px 10px var(--shadow);
}
.brand__role {
  /* set like a technical credit line / spec label */
  margin: 0.7em 0 0;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.9;
  text-shadow: 0 1px 8px var(--shadow);
}

/* Social icons: black-on-transparent PNGs used as masks so we can tint them
   white by default and black on hover (matching the menu hover behavior). */
.social {
  display: flex;
  gap: 14px;
  margin: 14px 0 18px;
}
.social__icon {
  width: 20px;
  height: 20px;
  background-color: var(--fg);
  -webkit-mask: center / contain no-repeat;
          mask: center / contain no-repeat;
  filter: drop-shadow(0 1px 6px var(--shadow));
  transition: background-color 0.18s ease, transform 0.18s ease;
}
.social__icon[data-icon="x"]     { -webkit-mask-image: url("../images/x.png");     mask-image: url("../images/x.png"); }
.social__icon[data-icon="be"]    { -webkit-mask-image: url("../images/Be.png");    mask-image: url("../images/Be.png"); }
.social__icon[data-icon="in"]    { -webkit-mask-image: url("../images/in.png");    mask-image: url("../images/in.png"); }
.social__icon[data-icon="insta"] { -webkit-mask-image: url("../images/insta.png"); mask-image: url("../images/insta.png"); }
.social__icon:hover { background-color: #000; transform: translateY(-1px); }

/* Menu items: white, turn black on hover. */
.menu {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.menu__item {
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 8px var(--shadow);
  transition: color 0.18s ease;
}
.menu__item:hover,
.menu__item:focus-visible { color: #000; text-shadow: none; }
.menu__item[aria-current="page"] { color: var(--edit-blue); text-shadow: none; }

/* Language switch (En / Jp), sits just under the menu. The current language
   is highlighted in edit-blue, like the active menu item. */
.lang {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.lang__opt {
  color: var(--fg);
  text-decoration: none;
  text-shadow: 0 1px 8px var(--shadow);
  transition: color 0.18s ease;
}
.lang__opt:hover,
.lang__opt:focus-visible { color: #000; text-shadow: none; }
.lang__opt.is-active { color: var(--edit-blue); text-shadow: none; cursor: default; }
.lang__sep { opacity: 0.45; }

/* ---------- Look-around arrows ---------- */
.arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 19px;          /* half of the 38×77 native arrow size */
  height: 38px;
  padding: 0;
  border: 0;
  background: center / contain no-repeat transparent;
  cursor: pointer;
  opacity: 0.7;
  filter: drop-shadow(0 1px 6px var(--shadow));
  transition: opacity 0.18s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.arrow:hover { opacity: 1; }
.arrow.is-pressed { opacity: 1; transform: translateY(-50%) scale(0.9); }
.arrow--left  { left: 18px;  background-image: url("../images/arrow_left.png"); }
.arrow--right { right: 18px; background-image: url("../images/arrow_right.png"); }

/* ---------- Hint ---------- */
.hint {
  position: fixed;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.55;
  text-shadow: 0 1px 8px var(--shadow);
  transition: opacity 0.6s ease;
}
.hint.is-hidden { opacity: 0; }

/* =====================================================================
 *  Interior pages (e.g. About) — normal scrolling document, no VR.
 * ===================================================================== */

/* The top page locks scrolling for the VR view; interior pages scroll. */
html:has(body.subpage) { height: auto; }
body.subpage {
  height: auto;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  background: #4377bb;             /* fallback behind the parallax layer */
}
/* Parallax background: a fixed layer that pans slower than the page scrolls
   (js/parallax.js sets --bg-y to a fraction of scrollY), so the scene reads as
   "further away" than the content — a sense of depth. bg_v.jpg is tileable, so
   it repeats vertically (repeat-y) and keeps scrolling past the bottom edge
   instead of stopping. */
body.subpage::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #4377bb url("../images/bg_v.jpg") center top / 100% auto repeat-y;
  background-position-y: var(--bg-y, 0px);
  pointer-events: none;
}


/* On interior pages the menu scrolls with the document instead of being fixed. */
.subpage .ui--topleft { position: absolute; }

/* Content column. Mobile-first: the framed block sits below the menu. */
.content {
  position: relative;
  z-index: 1;
  padding: 290px 18px 72px;       /* mobile: framed block centered below the menu */
}

/* ---------- Framed content window (window_frame.svg) ---------- */
.frame-window {
  max-width: 720px;
  margin: 0 auto;                 /* mobile: horizontally centered (equal margins) */
  color: #f3f1ea;                 /* white text — the frame is now dark */
  background: transparent;        /* outside the rounded frame stays transparent */
  /* Scalable vector frame: the SVG's corner decorations live in the 4 corner
     slices (fixed, crisp), the plain middle lines stretch cleanly, the white
     center fills the content, and everything outside the rounded path is
     transparent. Uniform 20-unit (200px @10×) slices fully contain each
     corner's bezier handles so nothing is split/stretched — the rendered
     frame matches the native SVG. */
  border: 70px solid transparent;
  border-image: url("../images/window_frame.svg?v=41") 200 fill stretch;
}
@media (max-width: 560px) {
  .frame-window { border-width: 48px; }
}

/* Desktop / landscape: the window's top-left corner rides a diagonal that
   parallels the menu_back blue curve, staying a similar distance from it.
   Wider viewport   -> corner higher & farther right (more room beside menu),
                       capped near the top of the "X" icon (~92px).
   Narrower viewport -> corner lower & farther left (hugs the curve down).
   Both axes interpolate with viewport width between 780px and 1500px.
   (Placed after the base rule so its margins win the cascade.) */
/* Landscape: move the window's top-left corner in a single straight line from
   point B to point A by viewport width; hold at A beyond 1054px.
     B: W= 780px -> box (left 30, top 290)  — identical to the phone/portrait
        position (centered, padding-top 290), so there is NO jump at the
        threshold, and it sits comfortably below the menu.
     A: W=1054px -> box (left 236, top 72)  [visible corner ≈ (256, 92), X-icon level]
   (Placed after the base rule so its margins win the cascade.) */
@media (min-width: 780px) {
  .content {
    padding: clamp(76px, calc(290px - (100vw - 780px) * 0.7810), 290px) 0 96px;
  }
  .frame-window {
    margin-left: clamp(30px, calc(30px + (100vw - 780px) * 0.7518), 236px);
    margin-right: auto;           /* left-aligned; free space grows on the right */
    /* Once the corner has settled (≥1054px, left margin held at 236px), let the
       window widen into the free space on the right instead of leaving it all
       as margin. Grows 1:1 with the viewport — keeping the same ~98px right gap
       it had at 1054px — from the base 720px up to 1.5× (1080px), then holds.
       Below 1054px this resolves to 720px, so narrow layouts are unchanged. */
    max-width: clamp(720px, calc(100vw - 334px), 1080px);
  }
}

.frame-window__title {
  margin: 0 0 0.6em;
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.06;
}
.frame-window p {
  margin: 0 0 1.05em;
  font-size: 1rem;
  line-height: 1.62;
}
.frame-window p:last-child { margin-bottom: 0; }

/* About page: portrait floated to the left, text wraps around it. */
.about__portrait {
  float: left;
  width: 220px;
  height: auto;
  margin: 4px 22px 14px 0;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
@media (max-width: 560px) {
  .about__portrait {
    float: none;
    display: block;
    width: 180px;
    margin: 0 auto 18px;
  }
}

/* About page: labelled link list at the bottom of the window. */
.about__links {
  clear: both;                       /* drop below the floated portrait */
  margin: 1.6em 0 0;
  padding: 1.2em 0 0;
  list-style: none;
  border-top: 1px solid rgba(243, 241, 234, 0.18);
}
.about__links li {
  margin: 0 0 0.7em;
  line-height: 1.4;
}
.about__links li:last-child { margin-bottom: 0; }
.about__links-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(243, 241, 234, 0.55);
}
.about__links a {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #7ea2ff;
  text-decoration: none;
  word-break: break-word;
}
.about__links a:hover { text-decoration: underline; }

/* Subsection heading (e.g. "My Contributions") + bullet list. */
.frame-window__subtitle {
  margin: 1.5em 0 0.55em;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.frame-window__list {
  margin: 0 0 1.05em;
  padding-left: 1.25em;
}
.frame-window__list li {
  margin: 0 0 0.4em;
  font-size: 1rem;
  line-height: 1.55;
}
.frame-window__list li::marker { color: #7ea2ff; }   /* accent marker */

/* Menu paths / code-like references (e.g. Filter -> Render -> Tree...). */
.frame-window__paths {
  margin: 0 0 1.1em;
  padding: 2px 0 2px 14px;
  list-style: none;
  border-left: 2px solid rgba(126, 162, 255, 0.5);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.95;
  color: rgba(243, 241, 234, 0.92);
}

/* Links inside a content window — lightened for the dark frame. */
.frame-window a {
  color: #7ea2ff;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1.5px solid rgba(126, 162, 255, 0.4);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.frame-window a:hover { color: #a9c1ff; border-bottom-color: #a9c1ff; }

/* Multiple project windows on one page stack with spacing. */
.content > .frame-window + .frame-window { margin-top: 56px; }

/* ---------- Note window ---------- */
.note__body {
  margin: 0;
  font-size: 0.82rem;        /* smaller, only for this note */
  line-height: 1.5;
}
.note__body mark {
  /* highlighter-marker effect: yellow highlight that wraps line-by-line */
  background: #fff263;
  color: inherit;
  padding: 0.08em 0.18em;
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- Project media (Technical Projects) ---------- */
.project__media {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 22px 0 6px;
}
.project__video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  object-fit: cover;            /* crop the square poster to the video frame */
}
.project__gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.project__figure { margin: 0; }
.project__figure--narrow { max-width: 440px; margin-left: auto; margin-right: auto; }

/* Artwork: masonry-style gallery for many mixed-aspect pieces. */
.art-gallery { columns: 2; column-gap: 16px; }
.art-gallery .project__figure { break-inside: avoid; margin: 0 0 16px; }
.art-gallery .project__figure figcaption { text-transform: none; letter-spacing: 0.01em; }
.art-gallery video { aspect-ratio: 16 / 9; }
@media (max-width: 560px) { .art-gallery { columns: 1; } }

/* Click-to-enlarge affordance + play badge on gallery videos. */
.art-gallery .is-zoomable { cursor: zoom-in; }
.art-gallery .project__figure:has(video) { position: relative; }
.art-gallery .project__figure:has(video)::before {
  content: ""; position: absolute; left: 50%; top: calc(50% - 13px);
  transform: translate(-50%, -50%);
  width: 58px; height: 58px; border-radius: 50%; background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.art-gallery .project__figure:has(video)::after {
  content: ""; position: absolute; left: calc(50% + 2px); top: calc(50% - 13px);
  transform: translate(-50%, -50%);
  border-style: solid; border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent #fff;
  pointer-events: none;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 5vmin;
  background: rgba(8, 10, 14, 0.93);
  cursor: zoom-out;
}
.lightbox.is-open { display: flex; }
.lightbox__stage { display: flex; max-width: 94vw; max-height: 92vh; }
.lightbox__media {
  max-width: 94vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
img.lightbox__media { cursor: zoom-out; }
video.lightbox__media { cursor: default; background: #000; }
.lightbox__close {
  position: fixed;
  top: 12px;
  right: 18px;
  z-index: 1001;
  width: 46px;
  height: 46px;
  padding: 0;
  background: none;
  border: 0;
  color: #f3f1ea;
  font: 700 2.1rem/1 var(--font-display);
  cursor: pointer;
  opacity: 0.85;
}
.lightbox__close:hover { opacity: 1; }
.project__figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
}
.project__figure figcaption {
  margin-top: 9px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(243, 241, 234, 0.62);   /* muted on the dark frame */
  line-height: 1.5;
}
.frame-window .project__source {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.75;
}
/* Small footnote disclaimer — same text color, just tiny. */
.frame-window .project__disclaimer {
  margin: 16px 0 0;
  font-size: 0.66rem;
  line-height: 1.5;
  opacity: 0.9;
}

@media (max-width: 560px) {
  .project__gallery { grid-template-columns: 1fr; }
}

/* ---------- Contact form ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }

.form__row { display: flex; flex-direction: column; gap: 7px; }
.form__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(243, 241, 234, 0.72);   /* mono labels on the dark frame */
}
.form__input {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #c5cad6;
  border-radius: 10px;
  padding: 11px 13px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form__input:focus {
  outline: none;
  border-color: var(--edit-blue);
  box-shadow: 0 0 0 3px rgba(0, 72, 252, 0.15);
}
.form__textarea { resize: vertical; min-height: 130px; line-height: 1.5; }

.form__row--inline {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.form__row--inline .form__label { margin: 0; }
.form__input--small { width: 96px; text-align: center; }

.form__submit {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #fff;
  background: var(--edit-blue);
  border: 0;
  border-radius: 11px;
  padding: 13px 26px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.06s ease;
}
.form__submit:hover { background: var(--edit-blue-deep); }
.form__submit:active { transform: translateY(1px); }

/* Honeypot: visually and pragmatically hidden, but present in the DOM. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Status messages */
.form-note {
  margin: 0 0 1.1em;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.98rem;
  line-height: 1.5;
}
.form-note--ok  { background: #e7f6ec; border: 1.5px solid #45b283; color: #166534; }
.form-note--err { background: #fdecec; border: 1.5px solid #e3a3a3; color: #9b1c1c; }
