/* ============================================================
   An Ha — anha.design
   Đổi bảng màu = sửa khối :root. Không sửa chỗ khác.
   ============================================================ */

:root {
  /* Đừng kéo --bg xuống sát đen: chữ sáng trên nền quá tối sẽ toả quầng. */
  --bg:            #121317;
  --surface:       #1A1D23;
  --surface-hover: #202430;
  --border:        rgba(255,255,255,.09);
  --border-mid:    rgba(255,255,255,.16);
  --text:          #D6D9DE;
  --muted:         #949AA3;
  --dim:           #8A919A;
  --accent:        #4D8DFF;
  --accent-hover:  #8CB4FF;

  --display: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --maxw:    70rem;
  --measure: 36rem;
  --gutter:  2rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

/* ---------- thanh ray dọc: khung lưới nhìn thấy được ---------- */

.rails { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.rails::before, .rails::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--border);
}
.rails::before { left:  calc(50% - var(--maxw)/2 + var(--gutter)); }
.rails::after  { right: calc(50% - var(--maxw)/2 + var(--gutter)); }
@media (max-width: 78rem) { .rails { display: none; } }

/* ---------- khung ---------- */

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.measure { max-width: var(--measure); }
section { position: relative; padding-block: clamp(4.5rem, 10vw, 8rem); }
hr.rule { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* ---------- chữ ---------- */

h1, h2, h3 {
  font-family: var(--display); font-weight: 500;
  letter-spacing: -0.032em; line-height: 1.06; margin: 0; text-wrap: balance;
}
h1 { font-size: clamp(2.5rem, 7vw, 4.5rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.125rem); }
h3 { font-size: 1.1875rem; }

p { margin: 0 0 1.15em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

.lede { font-size: clamp(1.0625rem, 1.9vw, 1.3125rem); color: var(--muted); line-height: 1.55; }
.muted { color: var(--muted); }

.label {
  font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim); font-weight: 500;
}

/* đầu mục có đánh số */
.section-head {
  display: flex; align-items: baseline; gap: .9rem;
  padding-bottom: 1.75rem; margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}
.section-head .num { font-family: var(--body); font-weight: 600; color: var(--accent); font-size: .75rem; letter-spacing: .08em; }

/* ---------- liên kết ---------- */

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ---------- header ---------- */

.site-head {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.25rem; }

.wordmark { display: flex; align-items: center; gap: .65rem; color: var(--text); }
.wordmark:hover { color: var(--text); opacity: .75; }
.wordmark svg { display: block; flex: none; }
.wordmark .stack { display: flex; flex-direction: column; gap: .2rem; line-height: 1; }
.wordmark .nm { font-family: var(--display); font-weight: 500; font-size: 1.1875rem; letter-spacing: -.025em; }
.wordmark .sub { font-size: .625rem; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); font-weight: 500; }
@media (max-width: 26rem) { .wordmark .sub { display: none; } }

.site-nav { display: flex; gap: 1.75rem; font-size: .875rem; }
.site-nav a { color: var(--muted); position: relative; }
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -3px; height: 1px;
  background: var(--accent); transition: right .25s ease;
}
.site-nav a:hover { color: var(--text); }
.site-nav a:hover::after { right: 0; }
/* ::after đã dùng cho gạch chân, nên vùng bấm phải mượn ::before. */
.site-nav a::before { content: ""; position: absolute; inset: -11px -8px; }

@media (max-width: 30rem) {
  .site-nav { gap: 1.1rem; font-size: .8125rem; }
  /* Màn hẹp: nới ngang ít lại kẻo hai vùng bấm dính nhau. */
  .site-nav a::before { inset: -12px -5px; }
}

/* ---------- hero ---------- */

.hero { padding-block: clamp(5rem, 13vw, 9.5rem) 0; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(48% 52% at 8% 58%,
              color-mix(in srgb, var(--accent) 14%, transparent), transparent 100%);
}
.hero .wrap { position: relative; z-index: 2; }
.hero h1 { max-width: 15ch; }
.hero h1 em { font-style: normal; color: var(--muted); display: block; }
.hero .lede { margin-top: 2rem; max-width: 44ch; }

.meta-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.75rem 2rem; margin-top: clamp(3.5rem, 8vw, 5.5rem);
  padding-block: 1.75rem; border-top: 1px solid var(--border);
}
.meta-strip dt { margin-bottom: .4rem; }
.meta-strip dd { margin: 0; font-size: .9375rem; color: var(--text); }

/* ---------- chuyển động ---------- */

/* 1. vệt sáng trôi rất chậm — thứ giữ cho nền không đứng im */
@keyframes drift {
  0%   { transform: translate3d(0,0,0)      scale(1);    opacity: .9; }
  50%  { transform: translate3d(5%,-4%,0)   scale(1.12); opacity: 1;  }
  100% { transform: translate3d(0,0,0)      scale(1);    opacity: .9; }
}
.hero::before { animation: drift 30s ease-in-out infinite; will-change: transform; }

/* 2. vào trang: nổi lên lần lượt */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal {
  opacity: 0;
  animation: rise .85s cubic-bezier(.2,.75,.25,1) forwards;
  animation-delay: var(--d, 0s);
}

/* 3. từ xoay trong tiêu đề — bề rộng dòng tự co giãn theo từ */
.rot { display: inline-block; white-space: nowrap; }
.rot > span { display: inline-block; transition: opacity .3s ease, transform .3s ease; }
.rot > span.leaving  { opacity: 0; transform: translateY(-.22em); }
.rot > span.entering { opacity: 0; transform: translateY(.22em); transition: none; }
/* Hẹp: từ xoay chiếm hẳn một dòng, để số dòng tiêu đề không đổi theo độ dài từ.
   Phải nằm SAU khối .rot ở trên — cùng độ ưu tiên thì quy tắc sau mới thắng. */
@media (max-width: 48rem) { .rot { display: block; } }

/* ---------- danh sách dự án ---------- */

.cases { display: flex; flex-direction: column; border-top: 1px solid var(--border); }

.case {
  display: grid;
  grid-template-columns: 3rem 1fr 11rem 2rem;
  gap: 0 1.5rem; align-items: start;
  padding: 2.25rem 1rem 2.25rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background-color .2s ease, padding-left .2s ease;
}
.case:hover { background: var(--surface); padding-left: 1rem; color: var(--text); }

.case-num { font-family: var(--body); color: var(--dim); font-size: .8125rem; padding-top: .7rem; letter-spacing: .06em; }
.case-title { display: block; font-family: var(--display); font-weight: 500; letter-spacing: -.03em; font-size: clamp(1.4375rem, 2.6vw, 1.8125rem); line-height: 1.18; }
.case:hover .case-title { color: var(--accent-hover); }
.case-hook { display: block; color: var(--muted); font-size: .9375rem; line-height: 1.55; margin-top: .65rem; max-width: 50ch; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .5rem; }
.tag {
  font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--border-mid);
  padding: .2rem .5rem; border-radius: 2px; white-space: nowrap;
}

.case-arrow { font-size: 1.125rem; color: var(--dim); padding-top: .3rem; transition: transform .2s ease, color .2s ease; }
.case:hover .case-arrow { transform: translateX(4px); color: var(--accent); }

.case[aria-disabled="true"] { opacity: .4; pointer-events: none; }

@media (max-width: 52rem) {
  .case { grid-template-columns: 2.25rem 1fr; }
  .case-arrow { display: none; }
  .tags { grid-column: 2; padding-top: 1rem; }
}

/* ---------- about ---------- */

.about-grid { display: grid; grid-template-columns: 12rem 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.portrait {
  width: 100%; aspect-ratio: 4/5; object-fit: cover;
  border-radius: 2px; border: 1px solid var(--border-mid); background: var(--surface);
  filter: grayscale(.25);
}
@media (max-width: 46rem) {
  .about-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 10rem; }
}

.statement {
  font-family: var(--display); font-weight: 500; letter-spacing: -.03em;
  font-size: clamp(1.3125rem, 2.6vw, 1.625rem);
  line-height: 1.25; color: var(--text); margin: 0 0 2rem; max-width: 26ch;
}
.statement em { font-style: normal; color: var(--accent); }

/* ---------- contact ---------- */

.contact-links { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; margin-top: 2rem; font-size: 1.0625rem; }
.contact-links a { display: inline-flex; align-items: center; gap: .5rem; }
.contact-links a::after { content: "↗"; font-size: .8em; color: var(--dim); }

/* ---------- case study ---------- */

.progress { position: fixed; top: 0; left: 0; height: 2px; background: var(--accent); width: 0; z-index: 30; }

.case-head { padding-block: clamp(4rem, 10vw, 7rem) 0; position: relative; overflow: hidden; }
.case-head::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(45% 50% at 8% 55%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 100%);
}
.case-head .wrap { position: relative; z-index: 2; }
.case-head h1 { max-width: 20ch; font-size: clamp(2.125rem, 5.5vw, 3.5rem); }
.case-head .lede { margin-top: 1.75rem; max-width: 48ch; }

.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1.75rem 2rem; margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--border);
}
.fact dt { margin-bottom: .4rem; }
.fact dd { margin: 0; font-size: .9375rem; }

.prose { max-width: var(--measure); }
.prose h2 {
  margin-top: 4rem; margin-bottom: 1.25rem; display: flex; align-items: baseline; gap: .75rem;
}
.prose h2::before {
  content: attr(data-num); font-family: var(--body); font-size: .6875rem;
  letter-spacing: .1em; color: var(--accent); flex: none;
}
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.1rem; margin: 0 0 1.15em; }
.prose li { margin-bottom: .5em; }

blockquote.pull {
  margin: 3rem 0; padding: 0 0 0 1.5rem; border-left: 2px solid var(--accent);
  font-family: var(--display); font-weight: 500; letter-spacing: -.028em;
  font-size: clamp(1.3125rem, 2.6vw, 1.5625rem);
  line-height: 1.28; color: var(--text);
}

figure { margin: 3.5rem 0; }
/* Phải bọc .shot riêng: border-radius trên <img> có padding không bo được ảnh. */
.shot {
  display: block;
  padding: .7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.shot img {
  width: 100%; height: auto; display: block;
  border-radius: 6px;
}
figcaption { margin-top: .75rem; max-width: var(--measure); font-size: .8125rem; line-height: 1.5; color: var(--dim); }

/* 75rem chứ không phải 70: đợi .wrap chạm max-width rồi mới nới,
   không thì tràn ngang khi có thanh cuộn. */
@media (min-width: 75rem) {
  /* :has(img) — figure chứa chữ thì để nguyên khổ cột. */
  .prose > figure:has(img) { width: calc(var(--maxw) - var(--gutter) * 2); }
}
figcaption { margin-top: .85rem; font-size: .8125rem; color: var(--dim); }

/* Ảnh giao diện đặt cạnh nhau thì hẹp quá, xếp dọc. */
.figure-stack .shot + .shot { margin-top: 1.25rem; }

.note {
  border: 1px solid var(--border); border-left: 2px solid var(--dim);
  background: var(--surface); padding: 1rem 1.25rem; font-size: .8125rem;
  color: var(--dim); margin: 3rem 0 0;
}

/* margin âm bù lại padding, để chữ vẫn thẳng lề. */
.back {
  display: inline-block; font-size: .9375rem;
  padding: 10px 12px;
  margin: calc(3.5rem - 10px) 0 0 -12px;
}

/* ---------- sơ đồ khối niềm tin (case 02) ---------- */

.trust {
  margin: 3rem 0 .9rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  overflow: hidden;
}
.trust-row {
  display: grid;
  grid-template-columns: 1.75rem 1fr 1.25rem 1fr;
  gap: 0 .9rem;
  align-items: baseline;
  padding: .95rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.trust-row.is-head { padding-block: .7rem; background: rgba(255,255,255,.02); }
.trust-row:last-of-type { border-bottom: 0; }

.trust-n { font-size: .6875rem; color: var(--dim); }
.trust-q { font-size: .9375rem; color: var(--muted); line-height: 1.45; }
.trust-arrow { font-size: .8125rem; color: var(--accent); }
.trust-a { font-size: .9375rem; color: var(--text); font-weight: 500; line-height: 1.45; }
.is-head .trust-q, .is-head .trust-a {
  font-size: .625rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim); font-weight: 500;
}

.trust-foot {
  padding: .95rem 1.15rem;
  border-top: 1px solid var(--border-mid);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-size: .875rem; line-height: 1.55; color: var(--text);
}
.trust-foot b { font-weight: 500; }

@media (max-width: 34rem) {
  .trust-row { grid-template-columns: 1.5rem 1fr; gap: .3rem .75rem; }
  .trust-row.is-head { display: none; }
  .trust-arrow { display: none; }
  .trust-q, .trust-a { grid-column: 2; }
  .trust-a::before { content: "\2192\00a0"; color: var(--accent); font-weight: 400; }
}

/* ---------- footer ---------- */

.site-foot { border-top: 1px solid var(--border); padding-block: 3rem; font-size: .8125rem; color: var(--dim); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
