/* =========================================================================
   Kyle Saiki — Portfolio  ·  styles.css
   Compact, editorial, precise. White + Apple-gray surfaces, near-black ink,
   one restrained blue accent, IBM Plex Mono for small labels.
   Tokens live in :root — change a value there and it updates everywhere.
   ========================================================================= */

/* ----------  TOKENS  ---------- */
:root {
  --bg:        #FFFFFF;
  --bg-soft:   #F5F5F7;

  --ink:       #1D1D1F;
  --ink-2:     #515154;
  --ink-3:     #86868B;

  --line:      #E8E8ED;
  --line-2:    #D2D2D7;

  --accent:    #0A66FF;

  --display: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --max: 1040px;                          /* content column */
  --pad-x: clamp(1.25rem, 4vw, 2.25rem);  /* page indentation — nav matches this */
  --sec-y: clamp(2.25rem, 5vw, 3.25rem);  /* vertical rhythm — compact */
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 68px;

  --ease: cubic-bezier(0.33, 0, 0.1, 1);
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 12px 32px rgba(0,0,0,0.06);
}

/* ----------  RESET / BASE  ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 12px);
}
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ----------  SHARED PRIMITIVES  ---------- */
.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.625rem;
}

.section { padding: var(--sec-y) var(--pad-x); }
.section--soft { background: var(--bg-soft); }
.section__inner { max-width: var(--max); margin: 0 auto; }
.section__head { margin-bottom: 1.5rem; }
.section__title {
  font-family: var(--display);
  font-size: clamp(1.625rem, 3vw, 2.125rem);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--body);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5625rem 1.0625rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  white-space: nowrap;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease),
              color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #0855D6; border-color: #0855D6; }
.btn--ghost { background: var(--bg); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }

/* mono spec rows */
.specs { border-top: 1px solid var(--line-2); }
.spec {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 1rem;
  padding: 0.5625rem 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 0.9375rem;
}
.spec dt {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 0.2em;
}
.spec dd { color: var(--ink-2); }

/* bullets */
.bullets li {
  position: relative;
  padding-left: 1.0625rem;
  margin-bottom: 0.4375rem;
  font-size: 0.9063rem;
  color: var(--ink-2);
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--line-2);
}
.bullets li:last-child { margin-bottom: 0; }

/* labeled image placeholders (show until the real file exists) */
.frame__ph, .xp__mark-ph, .card__thumb-ph, .g-cell__ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(45deg, transparent 0 10px, rgba(0,0,0,0.015) 10px 20px),
    var(--bg-soft);
  z-index: 1;
}
.frame__ph span, .card__thumb-ph span, .g-cell__ph span {
  font-family: var(--mono);
  font-size: 0.625rem;
  color: var(--ink-3);
  border: 1px dashed var(--line-2);
  border-radius: 6px;
  padding: 0.3125rem 0.5rem;
  background: var(--bg);
  text-align: center;
}

/* =========================================================================
   TOP NAV — aligned to the page content column
   ========================================================================= */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(255,255,255,0.82);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.topnav__inner {
  /* max + padding so the NAME lines up with the section content edge below */
  max-width: calc(var(--max) + (var(--pad-x) * 2));
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--pad-x);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.topnav__name {
  font-family: var(--display);
  font-weight: 650;
  font-size: 1.4375rem;
  letter-spacing: -0.022em;
  white-space: nowrap;
}
.nav { margin-left: auto; min-width: 0; }
.nav__list {
  display: flex;
  gap: 0.125rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav__list::-webkit-scrollbar { display: none; }
.nav__link {
  display: inline-block;
  font-size: 1.0313rem;
  font-weight: 500;
  color: var(--ink-2);
  padding: 0.4375rem 0.8125rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav__link:hover { color: var(--ink); background: var(--bg-soft); }
.nav__link.is-active { color: var(--ink); background: var(--bg-soft); }

/* =========================================================================
   ABOUT / HERO
   ========================================================================= */
.hero { padding-top: clamp(2.5rem, 5vw, 3.5rem); padding-bottom: clamp(2.5rem, 5vw, 3.5rem); }
.hero__grid {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 268px;   /* 268px display ≤ 660px source → retina-sharp */
  gap: clamp(1.75rem, 5vw, 3.5rem);
  align-items: center;
}
.hero__name {
  font-family: var(--display);
  font-size: clamp(2.375rem, 5.5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin-bottom: 1.25rem;
}
.hero__photo { margin: 0; }
.frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  aspect-ratio: 660 / 869;
  background: var(--bg-soft);
}
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* =========================================================================
   EDUCATION — compact horizontal résumé rows
   ========================================================================= */
.edu { border-top: 1px solid var(--line-2); }
.edu__row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9375rem 0;
  border-bottom: 1px solid var(--line-2);
}
.edu__degree {
  font-family: var(--display);
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.edu__school { font-size: 0.875rem; color: var(--ink-2); margin-top: 0.0625rem; }
.edu__honors {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-top: 0.25rem;
}
.edu__dates {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

/* =========================================================================
   EXPERIENCE — two independent columns
   ========================================================================= */
.xp {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.125rem;
  align-items: start;
}
.xp__col { display: flex; flex-direction: column; gap: 1.125rem; }
.xp__item {
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 1.25rem 1.375rem;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.xp__item:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.xp__head { display: flex; align-items: center; gap: 0.75rem; }
.xp__mark {
  position: relative;
  flex: 0 0 44px;
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: var(--bg-soft);
}
.xp__mark img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.xp__mark-ph span {
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.xp__role {
  font-family: var(--display);
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.018em;
  line-height: 1.2;
}
.xp__org { font-size: 0.875rem; font-weight: 500; color: var(--accent); margin-top: 0.0625rem; }
.xp__meta {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0.75rem 0 0.625rem;
}

/* =========================================================================
   PROJECTS
   ========================================================================= */
.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.125rem;
}
.card {
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.card__thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card__body { display: flex; flex-direction: column; flex: 1; padding: 1rem 1.125rem 1.125rem; }
.card__title {
  font-family: var(--display);
  font-size: 1.0313rem;
  font-weight: 650;
  letter-spacing: -0.018em;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}
.card__meta {
  font-family: var(--mono);
  font-size: 0.5938rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
}
.card__tagline { font-size: 0.8438rem; color: var(--ink-2); margin-bottom: 0.75rem; }
.card__tags { display: flex; flex-wrap: wrap; gap: 0.3125rem; margin-bottom: 0.875rem; }
.tag {
  font-family: var(--mono);
  font-size: 0.5938rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1875rem 0.5rem;
}
.card__more {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: auto;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
}
.card__more svg { transition: transform 0.25s var(--ease); }
.card:hover .card__more svg { transform: translateX(3px); }

/* =========================================================================
   CONTACT + FOOTER
   ========================================================================= */
.contact { text-align: center; }
.contact__title {
  font-family: var(--display);
  font-size: clamp(1.625rem, 3vw, 2.125rem);
  font-weight: 650;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}
.contact__text { font-size: 0.9375rem; color: var(--ink-2); margin-bottom: 1.25rem; }
.contact__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.5625rem; }

.footer { margin-top: var(--sec-y); border-top: 1px solid var(--line-2); }
.footer__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 0 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.6563rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* =========================================================================
   PROJECT MODAL
   ========================================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 2.5vw, 1.75rem);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease);
}
.modal.is-open { visibility: visible; opacity: 1; }
.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(29,29,31,0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.modal__panel {
  position: relative;
  width: min(1180px, 100%);
  max-height: 92vh;
  background: var(--bg);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  overflow: hidden;
  transform: translateY(12px) scale(0.985);
  transition: transform 0.35s var(--ease);
}
.modal.is-open .modal__panel { transform: none; }
.modal__close {
  position: absolute;
  z-index: 5;
  top: 0.875rem;
  right: 0.875rem;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}
.modal__close:hover { color: var(--ink); transform: scale(1.05); }
.modal__scroll { max-height: inherit; overflow-y: auto; }

/* modal media — video embed (click-to-play poster, then iframe) */
.m-video { position: relative; aspect-ratio: 16 / 9; background: var(--ink); overflow: hidden; }
.m-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.m-video__poster {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: var(--ink);
}
.m-video__poster img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; transition: opacity 0.25s var(--ease); }
.m-video__poster:hover img { opacity: 1; }
.m-video__play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 68px; height: 68px;
  border-radius: 50%;
  background: rgba(255,255,255,0.94);
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  transition: transform 0.25s var(--ease);
}
.m-video__poster:hover .m-video__play { transform: translate(-50%, -50%) scale(1.06); }
.m-video__play svg { margin-left: 3px; }
.m-video__fallback {
  display: block;
  padding: 0.625rem 1.5rem 0;
  font-family: var(--mono);
  font-size: 0.6563rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.m-video__fallback a { color: var(--accent); }

/* modal media — image gallery grid */
.m-gallery {
  display: grid;
  gap: 0.625rem;
  padding: 1.5rem 1.5rem 0;
}
.g-cell {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  cursor: zoom-in;
  padding: 0;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.g-cell:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.g-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.g-cell__ph span { font-size: 0.5625rem; padding: 0.1875rem 0.375rem; }

/* a cell that spans rows (e.g. a tall phone screenshot beside two stacked photos) */
.g-cell--span { aspect-ratio: auto; }
.g-cell--span img { object-fit: contain; background: var(--bg-soft); }

/* zoom affordance */
.g-cell::after {
  content: "";
  position: absolute;
  z-index: 2;
  right: 0.5rem;
  bottom: 0.5rem;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none' stroke='%231D1D1F' stroke-width='1.6' stroke-linecap='round'><circle cx='7' cy='7' r='4.5'/><path d='M10.5 10.5L14 14M7 5v4M5 7h4'/></svg>") center / 14px no-repeat;
  border: 1px solid var(--line-2);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.g-cell:hover::after { opacity: 1; }

.m-body { padding: 1.25rem 1.5rem 1.5rem; }
.m-meta {
  font-family: var(--mono);
  font-size: 0.6563rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.4375rem;
}
.m-title {
  font-family: var(--display);
  font-size: 1.4375rem;
  font-weight: 650;
  letter-spacing: -0.022em;
  margin-bottom: 0.3125rem;
}
.m-tagline { font-size: 0.9375rem; color: var(--ink-2); margin-bottom: 0.75rem; }
.m-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 1.125rem; }
.m-section-label {
  font-family: var(--mono);
  font-size: 0.6563rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
}
.m-points { margin-bottom: 1.25rem; }
.m-points li {
  position: relative;
  padding-left: 1.0625rem;
  margin-bottom: 0.4375rem;
  font-size: 0.9063rem;
  color: var(--ink-2);
}
.m-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--line-2);
}
.m-links { display: flex; flex-wrap: wrap; gap: 0.5625rem; }

/* =========================================================================
   IMAGE LIGHTBOX
   ========================================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  place-items: center;
  padding: clamp(0.75rem, 3vw, 2.5rem);
}
.lightbox.is-open { display: grid; }
.lightbox__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20,20,22,0.92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.lightbox__img {
  position: relative;
  max-width: min(1500px, 94vw);
  max-height: 88vh;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.lightbox__btn {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.lightbox__btn:hover { background: rgba(255,255,255,0.24); transform: scale(1.05); }
.lightbox__btn--prev { left: clamp(0.5rem, 2vw, 1.75rem); }
.lightbox__btn--next { right: clamp(0.5rem, 2vw, 1.75rem); }
.lightbox__btn--close { top: clamp(0.5rem, 2vw, 1.75rem); right: clamp(0.5rem, 2vw, 1.75rem); width: 40px; height: 40px; }
.lightbox--single .lightbox__btn--prev,
.lightbox--single .lightbox__btn--next { display: none; }
.lightbox__count {
  position: absolute;
  bottom: clamp(0.75rem, 2.5vw, 1.75rem);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.72);
}

/* =========================================================================
   SCROLL-REVEAL
   ========================================================================= */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .card, .card__more svg, .modal, .modal__panel, .xp__item { transition: none; }
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 920px) {
  .projects { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  .xp { grid-template-columns: 1fr; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__photo { order: -1; }
  .frame { width: min(240px, 62vw); }
  .topnav__name { font-size: 1.125rem; }
  .nav__link { font-size: 0.875rem; padding: 0.375rem 0.5625rem; }
}
@media (max-width: 620px) {
  .projects { grid-template-columns: 1fr; }
  .m-gallery { grid-template-columns: 1fr !important; padding: 1rem 1rem 0; }
  .m-gallery .g-cell { grid-area: auto !important; aspect-ratio: 4 / 3; }
  .m-gallery .g-cell--span { aspect-ratio: 3 / 4; }
  .edu__row { grid-template-columns: 1fr auto; row-gap: 0.75rem; }
  .edu__dates { grid-column: 1; }
  .edu__btn { grid-column: 2; grid-row: 2; }
  .spec { grid-template-columns: 88px 1fr; }
  .footer__inner { flex-direction: column; gap: 0.25rem; text-align: center; }
}