/* =========================================================
   yusikpark portfolio — base styles
   Illustrator comp: 1440 × 960 / Helvetica Neue Regular 12pt / 行送り 21.6 / トラッキング 0
   1デザインpx = 100vw / 1440 として、画面幅に比例して拡縮します
   ========================================================= */

:root {
  --u: calc(100vw / 1440);                       /* 1 design px */
  --fs: clamp(14px, calc(12 * var(--u)), 22px);  /* 12pt @1440 */
  --lh: 1.2;                                     /* 21.6 / 18 */
  --line: calc(var(--fs) * var(--lh));           /* 1行の高さ */
  --m: clamp(12px, calc(14 * var(--u)), 20px);   /* 外側の余白 */
  --nav-gap: calc(81 * var(--u));                /* メニュー間隔 */
  --col: calc(470 * var(--u));                   /* 画像カラムの開始位置 */
  --feed-top: calc(275 * var(--u));              /* 1枚目の画像の上端 */
  --feed-gap: calc(48 * var(--u));               /* 画像同士の間隔 */

  --bg: #fff;
  --fg: #000;
   --accent: #ff0000;   /* 十字線・名前の線の色（ライト） */
   --accent-blend: #00ffff;  /* 左テキスト・メニュー用。反転表示されるので赤の反対色を指定 */
  --placeholder: #ccc;

  --font-en: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-ja: "Helvetica Neue", Helvetica, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  --font-ko: "Helvetica Neue", Helvetica, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

/* 和文・ハングルは行送り1.2だと詰まりすぎるので少し広げる */
html:lang(ja), html:lang(ko) { --lh: 1.5; }

/* ダークモード：背景を反転するだけ（文字は下の difference で自動反転） */
html[data-theme="dark"] {
  --bg: #000;
  --fg: #fff;
  --accent: #3dffb4;   /* ダーク：赤を反転した水色 */
  --accent-blend: var(--accent);
  --placeholder: #444;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg);
  scroll-snap-type: none;   /* スワイプで1枚ずつ止まる（LP的） */
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  font-family: var(--font-en);
  font-size: var(--fs);
  line-height: var(--lh);
  font-weight: 400;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html:lang(ja) body { font-family: var(--font-ja); }
html:lang(ko) body { font-family: var(--font-ko); word-break: keep-all; }
html:lang(ja) .statement { word-break: auto-phrase; } /* 文節で改行（Chrome） */

p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button {
  font: inherit; color: inherit; letter-spacing: inherit;
  background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer;
}
img { display: block; }

/* ---------- 共通の固定レイヤー（左テキスト＋右上メニュー） ----------
   画像の上に重なっても読めるよう、白文字＋difference で
   「白地では黒・黒地では白・画像上では反転色」に自動で切り替わる */
.site-info,
.site-header {
  position: fixed;
  z-index: 10;
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;            /* 文字の下の画像もクリックできるように */
}
.site-info a,
.site-header a,
.site-header button { pointer-events: auto; }

.site-info {
  top: var(--m);
  left: var(--m);
}
.block + .block { margin-top: var(--line); }   /* ブロック間＝空行1つ */
.statement { max-width: calc(960 * var(--u)); }

.site-header {
  top: var(--m);
  right: var(--m);
  text-align: right;
}
.site-nav {
  display: flex;
  justify-content: flex-end;
  gap: var(--nav-gap);
}
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent-blend);
}
.toggles { margin-top: var(--line); }   /* 左のステートメント1行目と揃える */

/* 切替ボタン：選択中だけ濃く、他は薄く */
.toggle button[aria-pressed="false"] { opacity: 0.4; }

/* hover：リンクにカーソルを当てると赤（ダークでは水色/ミント）に */
@media (hover: hover) {
  .site-info a:hover,
  .site-nav a:hover,
  .toggle button:hover { color: var(--accent-blend); }
  .toggle button[aria-pressed="false"]:hover { opacity: 1; }
  .contact-meta a:hover,
  .work-card a:hover .work-caption { color: var(--accent); }
}

/* ---------- 画像フィード ---------- */
.works-feed {
  display: grid;
  gap: var(--feed-gap);
  margin-left: var(--col);
  padding: var(--feed-top) var(--m) 50vh 0;
}
.work {
  scroll-snap-align: start;
  scroll-margin-top: var(--feed-top);   /* 何枚目でも1枚目と同じ位置に止まる */
}
.work a { display: block; }
.work img {
  max-width: 100%;
  width: auto;
  height: auto;
  /* 縦長画像が画面からはみ出さないように */
  max-height: calc(100svh - var(--feed-top) - var(--m));
}

/* 画像未設定のときの仮ボックス（コンプの×印） */
.work.is-placeholder a {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--placeholder);
  background:
    linear-gradient(to top right, transparent calc(50% - 0.5px), var(--placeholder) calc(50% - 0.5px), var(--placeholder) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom right, transparent calc(50% - 0.5px), var(--placeholder) calc(50% - 0.5px), var(--placeholder) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}

/* ---------- 作品のサムネイル・仮ボックス（共通） ---------- */
.work-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.work-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;          /* 16:9 に切り抜いて表示 */
}
.work-thumb.is-placeholder {
  border: 1px solid var(--placeholder);
  background:
    linear-gradient(to top right, transparent calc(50% - 0.5px), var(--placeholder) calc(50% - 0.5px), var(--placeholder) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom right, transparent calc(50% - 0.5px), var(--placeholder) calc(50% - 0.5px), var(--placeholder) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}

/* キャプション：左に作品名、右にカテゴリー */
.work-caption {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  margin-top: calc(6 * var(--u));
  font-size: max(12px, calc(var(--fs) * 0.67));   /* ← 本文の約2/3 */
  line-height: 1.3;
  color: var(--fg);
}

/* ---------- WORKS 一覧（2列グリッド） ---------- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: calc(97 * var(--u));     /* ← 列の間隔 */
  row-gap: calc(36 * var(--u));        /* ← 行の間隔 */
  margin-left: calc(516 * var(--u));   /* ← 左端の位置 */
  padding: calc(301 * var(--u)) calc(59 * var(--u)) calc(120 * var(--u)) 0;
}
.work-card a { display: block; }

/* ---------- 作品詳細：左下の固定キャプション ---------- */
.work-info {
  position: fixed;
  left: var(--m);
  bottom: var(--m);
  z-index: 5;
  width: calc(420 * var(--u));     /* ← キャプションの幅 */
  color: var(--fg);
}
/* スマホ：固定をやめ、画像の上に置く */
@media (max-width: 767px) {
  .work-info {
    position: static;
    width: auto;
    padding: calc(var(--line) * 2) var(--m) 0;
  }
  .work-info + .works-feed { padding-top: var(--line); }
}

/* 下層ページの仮コンテンツ */
.page-body {
  margin-left: var(--col);
  padding: var(--feed-top) var(--m) var(--m) 0;
}

/* ---------- 十字線カーソル ---------- */
.cursor-line {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  background: var(--accent);          /* ← 線の色 */
  pointer-events: none;         /* クリックの邪魔をしない */
  opacity: 0;
  transition: opacity 0.2s;
}
.cursor-x { width: 100vw; height: 0.5px; }   /* ← 横線の太さ */
.cursor-y { width: 0.5px; height: 100vh; }   /* ← 縦線の太さ */
.has-cursor .cursor-line { opacity: 1; }

/* ---------- TOP：大きな名前 ---------- */
.hero-name {
  position: fixed;
  right: calc(0 * var(--u));            /* ← 右端の位置 */
  bottom: calc(15 * var(--u));          /* ← 下端の位置（小さくすると下に沈む） */
  z-index: 1;
  margin: 0;
  font-family: var(--font-en);
  font-weight: 500;                     /* ← Medium。イラレのウェイトに合わせて */
  font-size: calc(242 * var(--u));      /* ← 大きさ（1440px幅で242px） */
  line-height: 1;
  letter-spacing: 0;                    /* ← イラレのトラッキング値 ÷ 1000 (em) */
  font-kerning: normal;
  color: var(--fg);
  white-space: nowrap;
}

/* カーソルが当たった1文字だけ、塗り → 線（十字線と同じ色・太さ） */
.hero-name .char:hover {
  color: transparent;
  -webkit-text-stroke: 1px var(--accent);
}

/* 日本語・韓国語の名前：大きさは英語と同じ。横幅は main.js で英語に合わせて伸ばす（平体） */
html:lang(ja) .hero-name { font-family: var(--font-ja); }
html:lang(ko) .hero-name { font-family: var(--font-ko); }
.hero-inner {
  display: inline-block;
  transform-origin: right bottom;   /* 右下を基準に伸ばす */
}
.hero-probe {                       /* 英語の横幅を測るための見えない文字 */
  position: absolute;
  visibility: hidden;
  font-family: var(--font-en);
}

/* ---------- CONTACT ---------- */
.contact {
  position: fixed;
  right: var(--m);
  bottom: calc(15 * var(--u));
  text-align: right;
  color: var(--fg);
}
.contact-meta { margin-bottom: var(--line); }
.contact-email {
  display: block;
  margin-left: auto;
  font-family: var(--font-en);
  font-weight: 500;
  font-size: calc(86 * var(--u));      /* ← メールアドレスの大きさ */
  line-height: 1;
  white-space: nowrap;
}
.contact-hint { margin-top: calc(10 * var(--u)); }

/* カーソルが当たった1文字だけ、塗り → 線（TOPの名前と同じ） */
.contact-email .char:hover {
  color: transparent;
  -webkit-text-stroke: 0.5px var(--accent);
}

/* スマホ：固定をやめ、左揃えで縦に流す */
@media (max-width: 767px) {
  .contact {
    position: static;
    text-align: left;
    padding: calc(var(--line) * 2) var(--m) var(--m);
  }
  .contact-email { margin-left: 0; font-size: 8.5vw; }
}


/* =========================================================
   スマホ（〜767px）
   左テキストを固定すると画面が埋まるため、
   メニューだけ上部に固定し、テキスト→画像の順に縦に流す
   ========================================================= */
@media (max-width: 767px) {
  :root {
    --fs: 14px;
    --m: 12px;
    --feed-gap: 24px;
  }
  html { scroll-snap-type: none; 
    -webkit-tap-highlight-color: transparent;   /* タップ時のグレーの四角を消す */}  /* スマホは通常スクロールの方が快適 */

  .site-header {
    left: var(--m);
    text-align: left;
  }
  .site-nav { justify-content: space-between; gap: 0; }
  .toggles {
    margin-top: 0;
    display: flex;
    justify-content: space-between;
  }

  .site-info {
    position: static;
    mix-blend-mode: normal;
    color: #000;
    padding: calc(var(--m) + var(--line) * 3) var(--m) 0;
  }
  html[data-theme="dark"] .site-info { color: #fff; }
  .site-info a:hover { color: var(--accent); }   /* スマホは反転しないので通常の色 */

  .statement br { display: none; }   /* 手動改行は狭い画面では外す */
  .statement,
  html:lang(ja) .statement,
  html:lang(ko) .statement { max-width: none; }

  .works-feed,
  .page-body {
    margin-left: 0;
    padding: calc(var(--line) * 2) var(--m) var(--m);
  }
  .work img { max-height: none; width: 100%; }

  .hero-name {
    position: static;
    padding: calc(var(--line) * 2) 0 0;
    font-size: 21vw;
    text-align: right;
    overflow: hidden;
  }
    .works-grid {
    grid-template-columns: 1fr;
    row-gap: 24px;
    margin-left: 0;
    padding: calc(var(--line) * 2) var(--m) var(--m);
  }
  .work-caption { margin-top: 6px; }
}
