/* ============================================================
   anyway;DESIGN — portfolio (SPA)
   Palette: Bright Orange #FF5B05 / Charcoal #243037
            Cloud Grey #D3DDDE / Aqua Green #075056
   Type:    Poppins + Noto Sans TC（jf金萱暫以思源黑體代替）
   ============================================================ */

:root {
  --orange: #FF5B05;
  --charcoal: #243037;
  --charcoal-deep: #1a242b;
  --cloud: #D3DDDE;
  --cloud-bg: #EBF0F0;
  --aqua: #075056;
  --white: #ffffff;
  --paper: #f4efe4;
  --font-en: "Poppins", sans-serif;
  --font-zh: "Noto Sans TC", "PingFang TC", sans-serif;
  --ease: cubic-bezier(.65, .05, 0, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overscroll-behavior: none; overflow-x: hidden; }

body {
  font-family: var(--font-en), var(--font-zh);
  background: var(--charcoal);
  color: var(--cloud);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .6s var(--ease);
}
/* Home & work-detail dark; project light */
body.view-project { background: var(--cloud-bg); color: var(--charcoal); }
body.is-locked { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }
em { font-style: normal; }
::selection { background: var(--orange); color: var(--white); }

/* ---------- Grain (mersi-style) ---------- */
.grain {
  position: fixed; inset: -40px; z-index: 500; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .09; mix-blend-mode: overlay;
  animation: grain .7s steps(4) infinite;
  will-change: transform;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-24px, 12px); }
  50% { transform: translate(18px, -20px); }
  75% { transform: translate(-14px, -8px); }
  100% { transform: translate(20px, 16px); }
}

/* ---------- Orange glow (home) ---------- */
.glow {
  position: fixed; z-index: 1; pointer-events: none;
  width: 60vmax; height: 60vmax; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,91,5,.42) 0%, rgba(255,91,5,.14) 32%, transparent 62%);
  opacity: 0; transition: opacity .8s var(--ease);
  filter: blur(6px);
}
body.view-home .glow { opacity: 1; }

/* ---------- Cursor (Untold-style) ---------- */
.cursor, .cursor-ring { display: none; }
@media (pointer: fine) {
  body { cursor: none; }
  a, button, [data-hover] { cursor: none; }
  .cursor {
    display: block; position: fixed; z-index: 999; pointer-events: none;
    width: 7px; height: 7px; border-radius: 50%; background: var(--orange);
    transform: translate(-50%, -50%);
  }
  .cursor-ring {
    display: flex; align-items: center; justify-content: center;
    position: fixed; z-index: 998; pointer-events: none;
    width: 40px; height: 40px; border-radius: 50%;
    border: 1.5px solid rgba(255,91,5,.6);
    transform: translate(-50%, -50%);
    transition: width .4s var(--ease-out), height .4s var(--ease-out),
                background-color .3s, border-color .3s, opacity .3s;
  }
  .cursor-ring.is-hover { width: 66px; height: 66px; border-color: var(--orange); background: rgba(255,91,5,.08); }
  .cursor-ring.is-view { width: 92px; height: 92px; background: var(--orange); border-color: var(--orange); }
  .cursor-ring span {
    font-family: var(--font-en); font-size: 11px; font-weight: 500; letter-spacing: .12em;
    color: var(--white); opacity: 0; transition: opacity .25s;
  }
  .cursor-ring.is-view span { opacity: 1; }
}

/* ---------- Header ---------- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 700;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(20px, 4vw, 52px);
  mix-blend-mode: difference;   /* logo/menu stay legible on any bg */
  color: #fff;
}
.header.menu-open { mix-blend-mode: normal; color: var(--white); }
.logo { display: flex; align-items: center; gap: 11px; }
.logo__mark-wrap { width: 30px; height: 30px; display: grid; place-items: center; }
.logo__mark {
  width: 30px; height: 30px; object-fit: contain;
  transition: transform .6s var(--ease);
  transform-origin: 50% 50%;
}
/* Danielle-Levitt-style: mark spins on hover */
.logo:hover .logo__mark { transform: rotate(360deg); }
.logo__word { font-family: var(--font-en); font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.logo__word em { color: var(--orange); }
.header.menu-open .logo__word em { color: var(--charcoal); }

.menu-btn { display: flex; align-items: center; gap: 12px; }
.menu-btn__label { font-family: var(--font-en); font-weight: 400; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; }
.menu-btn__lines { position: relative; width: 26px; height: 12px; }
.menu-btn__lines i {
  position: absolute; left: 0; width: 100%; height: 1.6px; background: currentColor;
  transition: transform .45s var(--ease), top .45s var(--ease);
}
.menu-btn__lines i:nth-child(1) { top: 2px; }
.menu-btn__lines i:nth-child(2) { top: 8px; }
.header.menu-open .menu-btn__lines i:nth-child(1) { top: 5px; transform: rotate(45deg); }
.header.menu-open .menu-btn__lines i:nth-child(2) { top: 5px; transform: rotate(-45deg); }

/* ---------- Full-screen orange menu ---------- */
.menu {
  position: fixed; inset: 0; z-index: 650;
  background: var(--orange); color: var(--charcoal);
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(60px, 12vh, 140px) clamp(24px, 6vw, 96px) clamp(28px, 6vh, 56px);
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  transition: clip-path .7s var(--ease), visibility 0s .7s;
}
.menu.is-open { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path .8s var(--ease); }
.menu__list { margin-bottom: auto; margin-top: auto; }
.menu__list li { overflow: hidden; }
.menu__list a {
  display: inline-flex; align-items: baseline; gap: 16px;
  font-family: var(--font-en); font-weight: 600;
  font-size: clamp(44px, 12vw, 132px); line-height: 1.06; letter-spacing: -.02em;
  transform: translateY(110%);
  transition: opacity .3s;
  position: relative;
}
.menu.is-open .menu__list a { transform: translateY(0); }
.menu__list a::before {
  content: attr(data-i);
  font-size: clamp(13px, 1.4vw, 16px); font-weight: 400; letter-spacing: .1em;
  align-self: flex-start; margin-top: .4em; opacity: .55;
}
.menu__list a span { display: inline-block; transition: transform .5s var(--ease); }
.menu__list a:hover span { transform: translateX(18px); }
.menu__list a:hover { color: var(--white); }
.menu__foot {
  display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px;
  border-top: 1.5px solid rgba(36,48,55,.3); padding-top: 22px;
}
.menu__slogan { font-family: var(--font-en); font-weight: 300; font-size: clamp(13px, 1.6vw, 17px); letter-spacing: .02em; }
.menu__slogan em { font-weight: 600; }
.menu__social { display: flex; gap: 16px; }
.menu__social a { width: 22px; height: 22px; display: grid; place-items: center; transition: transform .3s; }
.menu__social a:hover { transform: translateY(-3px); }
.menu__social svg { width: 20px; height: 20px; fill: var(--charcoal); }

/* ---------- Views ---------- */
.view { display: none; }
.view.is-active { display: block; }
.view--home.is-active, .view--work.is-active { display: flex; }

.view__title {
  font-family: var(--font-en); font-weight: 600;
  font-size: clamp(30px, 5vw, 62px); letter-spacing: -.02em; line-height: 1.1;
}
.view__title span { display: inline-block; }

/* ---------- HOME ---------- */
.view--home {
  min-height: 100svh; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 20px; position: relative; z-index: 2;
}
.type {
  font-family: var(--font-en); font-weight: 600;
  font-size: clamp(23px, 6vw, 92px); line-height: 1.12; letter-spacing: -.01em;
  color: var(--white); max-width: 15ch; overflow-wrap: break-word;
}
.type__orange { color: var(--orange); }
.type__caret {
  display: inline-block; width: .06em; height: .92em; margin-left: .04em;
  background: var(--orange); vertical-align: baseline;
  animation: caret 1s steps(1) infinite; transform: translateY(.12em);
}
@keyframes caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
.home__zh {
  margin-top: clamp(24px, 4vh, 40px);
  font-family: var(--font-zh); font-weight: 300;
  font-size: clamp(13px, 1.6vw, 17px); letter-spacing: .5em; color: var(--cloud);
  opacity: .8; padding-left: .5em;
}

/* ---------- PROJECT ---------- */
.view--project { padding: clamp(110px, 16vh, 180px) clamp(20px, 5vw, 72px) clamp(60px, 10vh, 120px); min-height: 100svh; }
.project__head {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 20px;
  margin-bottom: clamp(32px, 6vh, 60px);
}
.project__filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-zh); font-size: 13px; letter-spacing: .08em;
  padding: 8px 18px; border-radius: 999px; border: 1px solid rgba(36,48,55,.25);
  transition: all .3s var(--ease); white-space: nowrap;
}
.chip:hover { border-color: var(--orange); color: var(--orange); }
.chip.is-active { background: var(--charcoal); color: var(--cloud); border-color: var(--charcoal); }
.chip .n { font-family: var(--font-en); font-size: 11px; margin-left: 6px; color: var(--orange); }
.project__grid {
  display: grid; gap: clamp(18px, 2.6vw, 34px);
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px) { .project__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .project__grid { grid-template-columns: 1fr; }
  .card__row { flex-direction: column; gap: 4px; }
  .card__cat { order: 3; }
}
.card { text-align: left; width: 100%; }
.card__media {
  position: relative; overflow: hidden; border-radius: 6px;
  aspect-ratio: 4 / 3; background: #dfe6e6;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease); }
.card:hover .card__media img { transform: scale(1.05); }
.card__media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(36,48,55,.4), transparent 46%);
  opacity: 0; transition: opacity .5s;
}
.card:hover .card__media::after { opacity: 1; }
.card__num {
  position: absolute; left: 12px; top: 10px; z-index: 2;
  font-family: var(--font-en); font-weight: 300; font-size: 12px; letter-spacing: .1em;
  color: var(--white); opacity: 0; transition: opacity .4s;
}
.card:hover .card__num { opacity: 1; }
.card__row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 14px; }
.card__title { font-family: var(--font-zh); font-weight: 500; font-size: 16px; letter-spacing: .03em; }
.card__en { font-family: var(--font-en); font-weight: 300; font-size: 11px; letter-spacing: .12em; color: var(--aqua); text-transform: uppercase; margin-top: 2px; }
.card__cat { font-family: var(--font-en); font-weight: 300; font-size: 11px; letter-spacing: .12em; color: var(--aqua); flex-shrink: 0; }

/* ---------- WORK DETAIL ---------- */
.view--work {
  flex-direction: column; align-items: center;
  padding: clamp(100px, 14vh, 150px) clamp(16px, 4vw, 56px) clamp(60px, 10vh, 110px);
  min-height: 100svh; background: var(--cloud-bg); color: var(--charcoal);
}
body:has(.view--work.is-active) { background: var(--cloud-bg); color: var(--charcoal); }
.work__back {
  align-self: flex-start; font-family: var(--font-zh); font-size: 14px; letter-spacing: .06em;
  color: var(--aqua); margin-bottom: clamp(28px, 5vh, 48px);
  transition: transform .3s var(--ease);
}
.work__back:hover { transform: translateX(-6px); }
.work__head { max-width: 820px; width: 100%; margin: 0 auto clamp(36px, 6vh, 60px); }
.work__cat { font-family: var(--font-en); font-weight: 300; font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--orange); margin-bottom: 14px; }
.work__title { font-family: var(--font-zh); font-weight: 500; font-size: clamp(26px, 4.4vw, 52px); letter-spacing: .04em; line-height: 1.25; }
.work__meta { font-family: var(--font-en); font-weight: 300; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--aqua); margin-top: 14px; }
.work__desc { font-family: var(--font-zh); font-weight: 300; font-size: 15px; line-height: 2; letter-spacing: .06em; color: rgba(36,48,55,.82); margin-top: 16px; max-width: 62ch; }
.work__gallery { max-width: 1000px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: clamp(16px, 3vh, 30px); }
.work__gallery img { width: 100%; border-radius: 6px; background: var(--white); }
.work__next {
  margin: clamp(48px, 8vh, 84px) auto 0; text-align: center;
  font-family: var(--font-zh); font-weight: 500; font-size: clamp(20px, 3vw, 32px); letter-spacing: .05em;
  transition: color .3s;
}
.work__next small { display: block; font-family: var(--font-en); font-weight: 300; font-size: 11px; letter-spacing: .32em; text-transform: uppercase; color: var(--orange); margin-bottom: 10px; }
.work__next:hover { color: var(--orange); }

/* ---------- Sticky notes (ium-style) ---------- */
.notes { position: fixed; inset: 0; z-index: 800; visibility: hidden; }
.notes.is-open { visibility: visible; }
.notes__scrim {
  position: absolute; inset: 0; background: rgba(26,36,43,.55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .5s var(--ease);
}
.notes.is-open .notes__scrim { opacity: 1; }
.note {
  position: absolute; top: 50%; left: 50%;
  width: min(92vw, 480px); max-height: 84vh; overflow-y: auto;
  background: var(--paper); color: var(--charcoal);
  padding: clamp(28px, 4vw, 44px); border-radius: 3px;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.5);
  transform: translate(-50%, -46%) rotate(-1.6deg) scale(.94);
  opacity: 0; visibility: hidden;
  transition: opacity .5s var(--ease), transform .55s var(--ease-out), visibility 0s .5s;
  background-image:
    linear-gradient(var(--paper), var(--paper)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23p)' opacity='0.04'/%3E%3C/svg%3E");
  background-blend-mode: multiply;
}
.note.is-shown { opacity: 1; visibility: visible; transform: translate(-50%, -50%) rotate(-1.6deg) scale(1); transition: opacity .5s var(--ease), transform .55s var(--ease-out); }
.note--contact.is-shown { transform: translate(-50%, -50%) rotate(1.4deg) scale(1); }
.note__tape {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  width: 120px; height: 28px; background: rgba(255,91,5,.32);
  border: 1px dashed rgba(255,91,5,.5);
}
.note__close {
  position: absolute; top: 14px; right: 16px; width: 30px; height: 30px; border-radius: 50%;
  font-size: 14px; color: var(--charcoal); transition: background-color .3s, color .3s;
}
.note__close:hover { background: var(--charcoal); color: var(--paper); }
.note__eyebrow { font-family: var(--font-en); font-weight: 400; font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--orange); margin-bottom: 14px; }
.note__title { font-family: var(--font-zh); font-weight: 500; font-size: clamp(20px, 3vw, 28px); line-height: 1.5; letter-spacing: .04em; margin-bottom: 20px; }
.note__p { font-family: var(--font-zh); font-weight: 300; font-size: 14.5px; line-height: 2; letter-spacing: .05em; margin-bottom: 14px; }
.note__sign { margin-top: 22px; font-family: var(--font-en); font-weight: 500; font-size: 15px; }
.note__sign span { display: block; font-weight: 300; font-size: 12px; letter-spacing: .1em; color: var(--aqua); margin-top: 2px; }
.note__sign em { color: var(--orange); }
.note__mail { display: inline-block; font-family: var(--font-en); font-weight: 500; font-size: clamp(18px, 2.6vw, 26px); color: var(--orange); border-bottom: 2px solid rgba(255,91,5,.3); padding-bottom: 3px; transition: border-color .3s; word-break: break-all; }
.note__mail:hover { border-color: var(--orange); }
.note__social { display: flex; gap: 14px; margin-top: 26px; }
.note__social a { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(36,48,55,.25); transition: background-color .3s, border-color .3s, transform .3s; }
.note__social a:hover { background: var(--charcoal); border-color: var(--charcoal); transform: translateY(-3px); }
.note__social a:hover svg { fill: var(--paper); }
.note__social svg { width: 18px; height: 18px; fill: var(--charcoal); transition: fill .3s; }
.note__company { margin-top: 26px; font-family: var(--font-zh); font-weight: 300; font-size: 12px; letter-spacing: .08em; color: rgba(36,48,55,.55); }

/* ---------- Reveal helpers ---------- */
.card { opacity: 0; transform: translateY(26px); }
.card.is-in { opacity: 1; transform: none; transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .grain { animation: none; }
  .card { opacity: 1; transform: none; }
}
