/* ============================================================
   petertien.cc — Peter AI Studio portal
   Ink-on-pigment. One mark-field, three grammars.
   No external assets: system font stacks only.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  /* --- surface & ink (light) --- */
  --paper:      #F4F1EA;
  --paper-2:    #EAE5D9;
  --surface:    #FCFBF7;
  --ink:        #211D15;
  --ink-2:      #5F5849;
  --ink-3:      #8F8776;
  --line:       #DED8C9;
  --line-soft:  #E9E4D7;

  /* --- canvas marks --- */
  --mark:       #C3BBA9;
  --mark-dim:   #D8D2C3;

  /* --- type roles --- */
  --f-display: "Avenir Next", "Avenir", Futura, "Century Gothic", "Segoe UI", system-ui, sans-serif;
  --f-serif:   "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --f-body:    "Segoe UI", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei",
               "Noto Sans TC", "Helvetica Neue", sans-serif;
  --f-mono:    ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* --- rhythm --- */
  --r-card: 18px;
  --r-soft: 11px;
  --gutter: clamp(20px, 4vw, 56px);
  --ease:   cubic-bezier(.22, .61, .30, 1);

  /* --- per-project pigment (default = English) --- */
  --accent:      #5B9282;
  --accent-text: #2E5C50;
  --accent-wash: rgba(91, 146, 130, .14);
  --on-accent:   #211D15;
}

:root[data-project="op"] {
  --accent:      #CCA84A;
  --accent-text: #75601C;
  --accent-wash: rgba(204, 168, 74, .16);
}
:root[data-project="stock"] {
  --accent:      #C17D92;
  --accent-text: #8F4E63;
  --accent-wash: rgba(193, 125, 146, .15);
}
:root[data-project="travel"] {
  --accent:      #5E8FAE;
  --accent-text: #34627E;
  --accent-wash: rgba(94, 143, 174, .15);
}
:root[data-project="tool"] {
  --accent:      #8B80B4;
  --accent-text: #574A85;
  --accent-wash: rgba(139, 128, 180, .15);
}

/* dark palette exists twice: once for the OS preference (unless the user
   explicitly chose light), once for the explicit toggle. Keep them in sync. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #191611;
    --paper-2:   #201C15;
    --surface:   #252017;
    --ink:       #F3EFE5;
    --ink-2:     #C6BEAD;
    --ink-3:     #9A9180;
    --line:      #383226;
    --line-soft: #2C2720;

    --mark:      #6F6754;
    --mark-dim:  #443E30;

    --accent:      #86B4A5;
    --accent-text: #97C2B4;
    --accent-wash: rgba(134, 180, 165, .14);
  }
  :root:not([data-theme="light"])[data-project="op"] {
    --accent:      #DDBE66;
    --accent-text: #E6CC80;
    --accent-wash: rgba(221, 190, 102, .14);
  }
  :root:not([data-theme="light"])[data-project="stock"] {
    --accent:      #D093A4;
    --accent-text: #DBA6B5;
    --accent-wash: rgba(208, 147, 164, .14);
  }
  :root:not([data-theme="light"])[data-project="travel"] {
    --accent:      #8FB8CF;
    --accent-text: #A0C5DA;
    --accent-wash: rgba(143, 184, 207, .14);
  }
  :root:not([data-theme="light"])[data-project="tool"] {
    --accent:      #AFA5D6;
    --accent-text: #BCB2E0;
    --accent-wash: rgba(175, 165, 214, .14);
  }
}

:root[data-theme="dark"] {
  --paper:     #191611;
  --paper-2:   #201C15;
  --surface:   #252017;
  --ink:       #F3EFE5;
  --ink-2:     #C6BEAD;
  --ink-3:     #9A9180;
  --line:      #383226;
  --line-soft: #2C2720;

  --mark:      #6F6754;
  --mark-dim:  #443E30;

  --accent:      #86B4A5;
  --accent-text: #97C2B4;
  --accent-wash: rgba(134, 180, 165, .14);
}
:root[data-theme="dark"][data-project="op"] {
  --accent:      #DDBE66;
  --accent-text: #E6CC80;
  --accent-wash: rgba(221, 190, 102, .14);
}
:root[data-theme="dark"][data-project="stock"] {
  --accent:      #D093A4;
  --accent-text: #DBA6B5;
  --accent-wash: rgba(208, 147, 164, .14);
}
:root[data-theme="dark"][data-project="travel"] {
  --accent:      #8FB8CF;
  --accent-text: #A0C5DA;
  --accent-wash: rgba(143, 184, 207, .14);
}
:root[data-theme="dark"][data-project="tool"] {
  --accent:      #AFA5D6;
  --accent-text: #BCB2E0;
  --accent-wash: rgba(175, 165, 214, .14);
}

/* ============================================================ */

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* faint pigment wash in the corner — the only ambient decoration */
body::before {
  content: "";
  position: fixed;
  inset: auto -14vw -22vh auto;
  width: 62vw;
  height: 62vw;
  max-width: 780px;
  max-height: 780px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--accent-wash), transparent 68%);
  pointer-events: none;
  z-index: 0;
  transition: background .7s var(--ease);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--ink);
  border-radius: 0 0 var(--r-soft) 0;
  font-size: 14px;
}
.skip:focus { left: 0; }

.shell {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 3vw, 30px) var(--gutter) clamp(16px, 2.6vw, 26px);
  gap: clamp(22px, 3.4vw, 44px);
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}

.wordmark-glyph {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0;
  transition: background .45s var(--ease);
}
.wordmark:hover .wordmark-glyph { background: var(--accent); color: var(--on-accent); }

.wordmark-text {
  font-family: var(--f-display);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
}

/* ---------- tabs & theme toggle ---------- */

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-btn {
  appearance: none;
  flex: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.theme-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn .i-moon { display: none; }
.theme-btn[data-mode="dark"] .i-sun  { display: none; }
.theme-btn[data-mode="dark"] .i-moon { display: block; }
.theme-btn:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

.tabs {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.tab-ink {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: transform .42s var(--ease), width .42s var(--ease), background .42s var(--ease);
  pointer-events: none;
}

.tab {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--f-display);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--ink-2);
  transition: color .3s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--on-accent); }

.tab:focus-visible,
.btn:focus-visible,
.wordmark:focus-visible,
.skip:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

/* ---------- stage ---------- */

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 60px);
  align-items: center;
}

.left {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vw, 34px);
  min-width: 0;
}

/* ---------- tagline (the brand line) ---------- */

.tagline { margin: 0; display: flex; flex-direction: column; gap: 7px; }

.tagline-studio {
  font-family: var(--f-display);
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 600;
  letter-spacing: -.008em;
  line-height: 1.15;
  color: var(--ink);
}

.tagline-line {
  font-family: var(--f-serif);
  font-style: normal;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: .02em;
  color: var(--ink-2);
}

/* ---------- entry card ---------- */

.card {
  position: relative;
  display: grid;                 /* panels stack in one cell */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: clamp(24px, 3vw, 34px) clamp(22px, 3vw, 34px) clamp(22px, 3vw, 30px);
  box-shadow: 0 1px 1px rgba(23,19,31,.03), 0 14px 34px -22px rgba(23,19,31,.32);
  overflow: hidden;
}

.card-edge {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 25%, transparent));
  transition: background .5s var(--ease);
}

.panel {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  opacity: 1;
  transition: opacity .3s var(--ease), transform .34s var(--ease);
}
.panel[inert] {
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  pointer-events: none;
}

.eyebrow {
  margin: 0;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--accent-text);
}

.proj-name {
  margin: -4px 0 0;
  font-family: var(--f-display);
  font-size: clamp(21px, 2.3vw, 24px);
  font-weight: 600;
  letter-spacing: -.012em;
  line-height: 1.18;
  color: var(--ink);
}

.proj-desc {
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.72;
  max-width: 40ch;
}

.facts {
  margin: 2px 0 4px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.facts li {
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: .02em;
  color: var(--ink-2);
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
}

/* ---------- button ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--f-body);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .01em;
  text-decoration: none;
  transition: transform .22s var(--ease), box-shadow .28s var(--ease), background .4s var(--ease);
  box-shadow: 0 8px 20px -12px color-mix(in srgb, var(--accent) 90%, transparent);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -14px color-mix(in srgb, var(--accent) 90%, transparent); }
.btn:active { transform: translateY(0); }

.btn-arrow { width: 17px; height: 17px; transition: transform .24s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(3px); }

.btn.is-soon {
  background: transparent;
  color: var(--accent-text);
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: none;
  cursor: default;
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .02em;
}
.btn.is-soon:hover { transform: none; box-shadow: none; }

/* ---------- status ---------- */

.status {
  margin: 2px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--ink-3);
}
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  box-shadow: none;
}
.status.is-live { color: var(--ink-2); }
.status.is-live .dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
  animation: breathe 3.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-wash); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}

.noscript {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
}
.noscript a { color: var(--accent-text); }

/* ---------- the field (signature) ---------- */

.right { min-width: 0; height: 100%; display: flex; }

.viz {
  position: relative;
  margin: 0;
  flex: 1;
  min-height: clamp(360px, 56vh, 620px);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface) 80%, transparent),
      color-mix(in srgb, var(--paper-2) 70%, transparent));
  overflow: hidden;
}

#field {
  display: block;
  width: 100%;
  height: 100%;
}

.viz-cap {
  position: absolute;
  left: 16px;
  bottom: 14px;
  right: 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .03em;
  color: var(--ink-3);
  pointer-events: none;
}
.viz-cap-key {
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 10px;
}
.viz-cap-text { transition: opacity .3s var(--ease); }
.viz-cap-text.is-swapping { opacity: 0; }

/* ---------- foot ---------- */

.footbar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .05em;
  color: var(--ink-3);
}
.foot-sep { color: var(--line); }

/* ============================================================
   responsive: stack under 900px
   ============================================================ */

@media (max-width: 900px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
  .right { order: 2; }
  .left  { order: 1; }
  .viz { min-height: clamp(240px, 38vh, 340px); }
  .topbar { gap: 14px; }
  .top-actions { width: 100%; }
  .tabs { flex: 1; justify-content: space-between; min-width: 0; }
  .tab { flex: 1; padding: 8px 6px; }
}

@media (max-width: 480px) {
  .tagline-studio { font-size: clamp(24px, 7vw, 28px); }
  .tagline-line { font-size: 15px; }
  .tab { font-size: 11.5px; padding: 8px 4px; letter-spacing: .02em; }
  .card { padding: 22px 18px 20px; }
  .proj-desc { font-size: 14.5px; }
  .btn { width: 100%; justify-content: center; }
}

/* ============================================================
   reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .status.is-live .dot { box-shadow: 0 0 0 3px var(--accent-wash); }
  .panel { transform: none; }
  .panel[inert] { transform: none; }
}
