/* Doan Nhat Tien — portfolio. Direction: contact-sheet (seed 836483954), type Switzer,
   palette rose-grey + green. One ground, one ink, one accent; flat surfaces, square corners. */

:root {
  --bg: #ebe5e3;
  --surface: #e1dad7;
  --surface-2: #d9d0cc;
  --ink: #2b2622;
  --muted: #5d554f;
  --accent: #0f7d45;
  --accent-ink: #f4f0ee;
  --step-small: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2.1rem, 1.4rem + 3vw, 3.6rem);
  --margin: clamp(16px, 2.6vw, 34px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
:root[data-theme="dark"] {
  --bg: #1c1916;
  --surface: #262220;
  --surface-2: #302a27;
  --ink: #ece4de;
  --muted: #b3a99f;
  --accent: #43b074;
  --accent-ink: #10261a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--step-body)/1.5 "Switzer", "Segoe UI", system-ui, sans-serif;
  letter-spacing: -0.005em;
}
::selection { background: var(--accent); color: var(--accent-ink); }
img { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-ui] :focus-visible, .card :focus-visible { outline-offset: -2px; }

h1, h2 { font-weight: 600; letter-spacing: -0.03em; line-height: 1.02; margin: 0; }
h2 { font-size: var(--step-head); }
p { margin: 0; }

/* hero skill chips (thay cho vòng ảnh) */
.skill-chip {
  position: absolute; display: inline-block; white-space: nowrap;
  background: var(--surface); color: var(--ink); padding: 7px 13px;
  font-weight: 500; letter-spacing: -0.01em; cursor: default;
  transition: opacity .3s ease;
}
.ring:hover .skill-chip { opacity: .45; }
.ring .skill-chip:hover { opacity: 1; background: var(--ink); color: var(--bg); }
@keyframes chip-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)) rotate(var(--rot, 0deg)); }
                     to { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); } }
.ring.anim .skill-chip { opacity: 0; animation: chip-in .7s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 40ms); }
.ring.anim .skill-chip { --rot: 0deg; }

/* typing dots */
.dots { display: inline-flex; gap: 5px; align-items: center; height: 1em; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: dot-jump 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .18s; }
.dots i:nth-child(3) { animation-delay: .36s; }
@keyframes dot-jump { 0%, 60%, 100% { transform: translateY(0); opacity: .5; }
                      30% { transform: translateY(-6px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; } }

/* resume timeline */
.resume-sec { margin-bottom: clamp(120px, 16vh, 220px); }
.resume-intro { max-width: 72ch; margin: 18px 0 6px; }
.resume-edu { color: var(--muted); margin-bottom: 8px; }
.timeline { border-left: 2px solid var(--surface-2); margin: 26px 0 8px 8px; padding-left: 26px; }
.t-item { position: relative; margin-bottom: 30px; }
.t-item::before { content: ""; position: absolute; left: -33px; top: 7px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); }
.t-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.t-role { font-weight: 600; font-size: var(--step-small); }
.t-period { color: var(--muted); font-size: var(--step-small); white-space: nowrap; }
.t-org { color: var(--ink); font-weight: 500; font-size: var(--step-small); margin: 2px 0; }
.t-stack { color: var(--muted); font-size: var(--step-small); font-style: italic; margin-bottom: 6px; }
.t-item ul { margin: 0; padding-left: 18px; color: var(--ink); }
.t-item li { margin-bottom: 5px; font-size: var(--step-small); overflow-wrap: anywhere; }
.t-item li::marker { color: var(--accent); }
.awards { list-style: none; padding: 0; margin: 28px 0 0; }
.awards li { background: var(--surface); border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 10px; color: var(--ink); font-size: var(--step-small); overflow-wrap: anywhere; }

/* pictures from the project: one treatment — greyscale */
.pic { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.06); }

/* ── top bar ─────────────────────────────────────────────── */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 18px var(--margin);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.mark { font-weight: 600; font-size: 1.05rem; text-decoration: none; letter-spacing: -0.02em; }
.top nav { display: flex; gap: clamp(12px, 2vw, 26px); font-size: var(--step-small); }
.top nav a { text-decoration: none; color: var(--muted); padding: 2px 0; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current] { color: var(--accent); }
.theme-btn {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  font-size: var(--step-small); padding: 2px 0; border-bottom: 2px solid var(--surface-2);
}
.theme-btn:hover { color: var(--ink); border-color: var(--ink); }

/* ── hero: ring of frames ────────────────────────────────── */
.hero { position: relative; min-height: 100svh; overflow: hidden; }
.ring { position: absolute; inset: 0; }
.ring a {
  position: absolute; display: block; overflow: hidden;
  transform: translate(-50%, -50%);
  transition: opacity .35s ease, filter .35s ease;
}
.ring a img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.06); }
.ring:hover a { opacity: .45; }
.ring a:hover, .ring a:focus-visible { opacity: 1; }
.core {
  position: relative; z-index: 2; height: 100svh;
  display: grid; place-content: center; text-align: center; padding: 0 24px;
  pointer-events: none;
}
.core > * { pointer-events: auto; }
.core h1 {
  font-size: clamp(3rem, 5.4vw, 5rem);
  max-width: 12ch; margin: 0 auto;
}
.core h1 .line { display: block; overflow: hidden; }
.core h1 .line span { display: block; transform: translateY(110%); }
.loaded .core h1 .line span { transform: translateY(0); transition: transform .9s var(--ease); }
.loaded .core h1 .line:nth-child(2) span { transition-delay: .11s; }
.core-sub { font-size: 1.15rem; margin: 22px auto 4px; max-width: 40ch; color: var(--ink); }
.core-role { font-size: var(--step-small); color: var(--muted); margin-bottom: 30px; }
.action {
  display: inline-block; background: var(--ink); color: var(--bg);
  text-decoration: none; border: 0; cursor: pointer;
  font-size: var(--step-body); font-weight: 500; padding: 12px 26px;
}
.action:hover { background: var(--accent); color: var(--accent-ink); }
.ring-note {
  position: absolute; left: var(--margin); bottom: 18px; z-index: 2;
  font-size: var(--step-small); color: var(--muted); max-width: 30ch;
}

/* one moving picture: the whole ring breathes very slightly */
@keyframes ring-drift { from { transform: scale(1); } to { transform: scale(1.035); } }
.ring { animation: ring-drift 26s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) {
    .ring { animation: none; }
  .loaded .core h1 .line span { transition: none; transform: none; }
  .ring.anim .skill-chip { animation: none; opacity: 1; }
  .core-sub, .core-role, .core .action { transition: none; opacity: 1; transform: none; }
}

[hidden] { display: none !important; }
section { padding: 18px var(--margin) 0; scroll-margin-top: 80px; } /* padding-top: line-height 1.02 khiến chữ h2 vượt lên trên mép section */
.t-item[id] { scroll-margin-top: 80px; }
.sheet-sec, .proof-sec, .closeup-sec, .book-sec, .contact-sec { margin: 0 0 clamp(120px, 16vh, 220px); }
#book { margin-top: clamp(40px, 8vh, 90px); }

/* ── hero entrance: từng khung ảnh + dòng chữ lõi ────────── */
@keyframes frame-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 16px)) rotate(var(--rot, 0deg)); }
                      to { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); } }
.core-sub, .core-role, .core .action { opacity: 0; transition: opacity .7s var(--ease), transform .7s var(--ease); transform: translateY(12px); }
body.core-in .core-sub, body.core-in .core-role, body.core-in .core .action { opacity: 1; transform: none; }

/* ── the contact sheet ──────────────────────────────────── */
.sheet-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 40px; margin-bottom: 26px; }
.sheet-desc { font-size: var(--step-small); color: var(--muted); min-height: 1.5em; }
.sheet { display: flex; flex-direction: column; gap: 26px; }
.run { transition: opacity .3s ease; }
.run-head {
  display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline;
  font-size: var(--step-small); margin-bottom: 8px;
}
.run-head .t { font-weight: 600; font-size: var(--step-body); letter-spacing: -0.01em; }
.run-head .c { color: var(--muted); }
.run-head .go { margin-left: auto; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.run-head .go:hover { text-decoration: underline; }
.frames { display: flex; flex-wrap: wrap; gap: 8px; }
.frames figure { margin: 0; height: clamp(96px, 13vh, 132px); flex: 0 0 auto; display: flex; }
.frames img { height: 100%; width: auto; max-width: none; }
.frames .drawn { height: 100%; width: auto; min-width: 150px; display: block; }
.sheet:hover .run { opacity: .45; }
.sheet .run:hover, .sheet .run:focus-within { opacity: 1; }

/* ── proof modules ──────────────────────────────────────── */
.module {
  display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 30px;
  align-items: start; margin: 0 0 clamp(64px, 9vh, 110px);
}
.module .panel {
  flex: 0 0 380px; height: 210px; background: var(--surface);
  overflow: hidden; display: grid; place-items: stretch;
}
.module .panel img { width: 100%; height: 100%; object-fit: cover; }
.module .panel .chat-frag { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.module .panel .chat-frag .b { padding: 7px 11px; max-width: 85%; }
.module .panel .chat-frag .u { align-self: flex-end; background: var(--ink); color: var(--bg); }
.module .panel .chat-frag .a { align-self: flex-start; background: var(--surface-2); }
.module .txt h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; margin: 2px 0 8px; }
.module .txt p { font-size: var(--step-body); color: var(--ink); max-width: 46ch; }
.module .txt p b { color: var(--ink); font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 6px 0; margin-top: 10px; font-size: var(--step-small); color: var(--muted); }
.tags span + span::before { content: "·"; margin: 0 7px; color: var(--surface-2); }
:root[data-theme="dark"] .tags span + span::before { color: var(--muted); }

/* ── closeup run ────────────────────────────────────────── */
.closeup-sec h2 { margin-bottom: 20px; }
.closeup-grid { display: grid; grid-template-columns: minmax(200px, 3fr) 9fr; gap: 28px; align-items: end; }
.closeup-note { font-size: var(--step-small); color: var(--muted); margin-top: 14px; }
.closeup-run { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; }
.closeup-run figure { margin: 0; flex: 0 0 auto; }
.closeup-run figure:has(.drawn) { flex: 1 1 230px; max-width: 100%; }
.closeup-run .drawn { display: block; width: 100%; height: auto; }
.closeup-run figure:has(.drawn) figcaption { flex-direction: column; gap: 4px; }
.module .panel > .drawn { display: block; width: 100%; height: auto; }
.closeup-run figure img { height: 30vh; max-width: 44vw; object-fit: cover; }
.closeup-run figure.lifted img { height: 58vh; max-width: 52vw; }
.closeup-run figcaption {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: var(--step-small); color: var(--muted); padding-top: 6px;
}
.closeup-run figcaption b { color: var(--ink); font-weight: 500; }

/* ── booking (app fragment) ─────────────────────────────── */
.book-note { color: var(--muted); font-size: var(--step-small); max-width: 62ch; margin: 14px 0 26px; }
.book-grid { display: grid; grid-template-columns: 360px minmax(0, 600px); gap: 28px; align-items: start; }
.card { background: var(--surface); padding: 18px 20px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-head button {
  background: var(--surface-2); border: 0; width: 32px; height: 32px;
  font-size: 18px; cursor: pointer;
}
.cal-head button:hover { background: var(--ink); color: var(--bg); }
.cal-dow, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-dow span { font-size: var(--step-small); color: var(--muted); }
.cal-days button {
  position: relative; background: var(--bg); border: 1px solid var(--surface-2); /* taste-skill-ignore: calendar control, real interface */
  padding: 9px 0; font-size: var(--step-small); cursor: pointer;
}
.cal-days button:disabled { opacity: .28; cursor: default; }
.cal-days button:not(:disabled):hover { border-color: var(--ink); }
.cal-days button.sel { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cal-days button.avail::after {
  content: ""; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.cal-days .pad { background: none; border: 0; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot {
  background: var(--bg); border: 1px solid var(--surface-2); padding: 8px 13px; /* taste-skill-ignore: slot control, real interface */
  font-size: var(--step-small); cursor: pointer; text-align: left;
}
.slot:hover { border-color: var(--ink); }
.slot small { display: block; color: var(--muted); font-size: 11px; }
#slot-date, .book-form h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 12px; }
.book-form { display: flex; flex-direction: column; gap: 10px; }
.book-form label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.book-form input, .book-form textarea {
  background: var(--bg); border: 1px solid var(--surface-2); color: var(--ink); /* taste-skill-ignore: form field */
  padding: 9px 11px; font: inherit; font-size: var(--step-small);
}
.book-form input:focus, .book-form textarea:focus { border-color: var(--accent); outline: none; }
.hp { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; } /* taste-skill-ignore: honeypot field, invisible by design */
.book-done p { font-size: 1rem; color: var(--ink); margin: 6px 0; }
.book-done p b { color: var(--ink); font-weight: 500; }
.book-done .row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.book-done a.action { font-size: 0.95rem; padding: 10px 18px; }
.btn-ghost {
  background: var(--surface-2); border: 0; padding: 10px 18px;
  font-size: 0.95rem; cursor: pointer;
}
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.book-hint { font-size: var(--step-small); color: var(--muted); }

/* ── contact ────────────────────────────────────────────── */
.contact-sec { display: grid; grid-template-columns: 5fr 2fr 3fr; gap: 30px; align-items: start; }
.contact-say { font-size: var(--step-lead); font-weight: 500; line-height: 1.25; letter-spacing: -0.01em; max-width: 30ch; }
.contact-links { display: flex; flex-direction: column; gap: 8px; }
.contact-q { font-weight: 500; }
.contact-mail, .contact-link { font-size: 1.05rem; text-decoration: underline; text-underline-offset: 3px; }
.contact-mail:hover, .contact-link:hover { color: var(--accent); }
.contact-city { font-size: var(--step-small); color: var(--muted); margin-top: 10px; }

/* ── footer ─────────────────────────────────────────────── */
footer { padding: 64px var(--margin) 40px; background: var(--surface); margin-top: clamp(40px, 8vh, 90px); }
.foot-name { font-size: clamp(3rem, 11vw, 9.5rem); font-weight: 600; letter-spacing: -0.045em; line-height: .95; }
.foot-line { font-size: var(--step-small); color: var(--muted); max-width: 70ch; margin-top: 14px; }

/* ── chat (floating: the one thing allowed a shadow) ────── */
.chat-fab {
  position: fixed; right: var(--margin); bottom: var(--margin); z-index: 60;
  background: var(--ink); color: var(--bg); border: 0; cursor: pointer;
  font-size: 0.95rem; font-weight: 500; padding: 13px 20px;
}
.chat-fab:hover { background: var(--accent); color: var(--accent-ink); }
.chat-panel {
  position: fixed; right: var(--margin); bottom: var(--margin); z-index: 61;
  width: min(400px, calc(100vw - 2 * var(--margin)));
  height: min(560px, calc(100svh - 2 * var(--margin)));
  display: none; flex-direction: column;
  background: var(--bg); box-shadow: 0 18px 60px rgba(0, 0, 0, .28); /* taste-skill-ignore: floating dialog overlay */
}
.chat-panel.open { display: flex; }
.chat-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--surface);
}
.chat-head small { display: block; font-size: var(--step-small); color: var(--muted); }
.chat-x { background: none; border: 0; cursor: pointer; font-size: var(--step-small); color: var(--muted); }
.chat-x:hover { color: var(--ink); text-decoration: underline; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 9px 13px; font-size: var(--step-body); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--bg); }
.msg.bot { align-self: flex-start; background: var(--surface); }
.msg.bot.error { background: var(--surface); color: #b3401f; }
.chat-chips { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 14px 10px; }
.chip { background: var(--surface); border: 0; color: var(--muted); padding: 5px 11px; font-size: var(--step-small); cursor: pointer; }
.chip:hover { color: var(--ink); background: var(--surface-2); }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; background: var(--surface); }
.chat-input input {
  flex: 1; background: var(--bg); border: 1px solid var(--surface-2); color: var(--ink);
  padding: 10px 12px; font: inherit; font-size: 14.5px;
}
.chat-input input:focus { border-color: var(--accent); outline: none; }
.chat-input button {
  background: var(--ink); color: var(--bg); border: 0; padding: 0 16px; font-size: 14px; cursor: pointer;
}
.chat-input button:hover { background: var(--accent); color: var(--accent-ink); }

/* ── phone ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .module { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .top nav { gap: 11px; }
  .top nav a[href="#contact"] { display: none; }  /* contact còn ở footer */
}

@media (max-width: 760px) {
  .top { padding: 16px var(--margin); background: var(--bg); }
  .top nav { gap: 12px; }
  .hero { min-height: 100svh; }
  .core { height: 100svh; }
  .ring-note { display: none; }
  .sheet-sec, .proof-sec, .closeup-sec, .book-sec, .contact-sec { margin-bottom: 90px; }
  .module { flex-direction: column; gap: 14px; }
  .module .panel { flex: none; width: 100%; height: 200px; }
  .closeup-grid { grid-template-columns: 1fr; }
  .closeup-run figure img { height: 34vw; }
  .closeup-run figure.lifted img { height: 74vw; }
  .book-grid { grid-template-columns: 1fr; }
  .contact-sec { grid-template-columns: 1fr; gap: 18px; }
}
