/* Cascade layers: "base" holds hand-written styles, "resp" the generated window styles
   (css/windows.gen.css), which stand in for the design's inline styles and must win. */
@layer base, resp;

@layer base {

/* Shared styles: tokens, base, nav, phone menu, footer.
   Layouts: phone <=600 (designed at 390), tablet 601-1024 (768), desktop >1024 (1440). */

:root {
  --bg: #FAF3E1;
  --card: #FFFCF4;
  --ink: #000;
  --pad: 16px;
}
@media (min-width: 601px) { :root { --pad: 32px; } }
@media (min-width: 1025px) { :root { --pad: clamp(40px, 8.3333vw, 120px); } }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  background: var(--bg);
  color: var(--ink);
}
/* Tilted Polaroids and the avatar's raised hands overshoot while animating.
   Clip on main (not body, which would propagate to the viewport). */
main { overflow-x: clip; }
a { color: #000; text-decoration: none; transition: color .2s, background-color .2s; }
a:hover { text-decoration: underline; text-underline-offset: 6px; }
a:focus-visible, button:focus-visible { outline: 2px solid #000; outline-offset: 4px; }
button { font-family: inherit; cursor: pointer; color: #000; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
img { max-width: none; }

.wrap { max-width: 1440px; margin: 0 auto; }

.btn-solid:hover { background: #FAF3E1 !important; color: #000 !important; text-decoration: none; }
.btn-dashed:hover { background: #000; color: #FAF3E1; text-decoration: none; }

/* Typing helpers */
.caret { display: inline-block; position: relative; width: 0; height: 1em; vertical-align: -0.15em; }
.caret::after { content: ""; position: absolute; left: 2px; top: 0; width: 3px; height: 100%; background: currentColor; animation: caret-blink 1s steps(1) infinite; }
.caret[hidden] { display: none; }
@keyframes caret-blink { 50% { opacity: 0; } }
.ghost { color: transparent; }

/* ---------- Nav ---------- */
.site-nav { position: sticky; top: 0; z-index: 60; background: var(--bg); }
.navin {
  display: flex; justify-content: space-between; align-items: center;
  height: 80px; margin: 0 var(--pad); border-bottom: 1.5px solid #000;
}
.brand { font-size: 26px; letter-spacing: 0.5px; }
.navlinks { display: flex; gap: 48px; font-size: 20px; }
.navlinks a { padding: 10px 0; }
.mhb { display: none; }

@media (max-width: 1024px) {
  .navin { height: 72px; }
  .brand { font-size: 22px; }
  .navlinks { gap: 32px; font-size: 18px; }
  .navlinks a { padding: 12px 0; }
}

@media (max-width: 600px) {
  .navin { height: 64px; }
  .brand { font-size: 20px; }
  .navlinks { display: none; }

  .mhb { display: block; position: relative; width: 44px; height: 44px; padding: 0; background: none; border: 0; transition: transform .15s; }
  .mhb:hover { transform: scale(1.08); }
  .mhb i { position: absolute; left: 11px; width: 22px; height: 2.5px; background: currentColor; border-radius: 2px; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .2s; }
  .mhb i:nth-child(1) { top: 14px; }
  .mhb i:nth-child(2) { top: 20.75px; }
  .mhb i:nth-child(3) { top: 27.5px; }
  .menu-open .mhb i:nth-child(1) { transform: translateY(6.75px) rotate(45deg); }
  .menu-open .mhb i:nth-child(2) { opacity: 0; }
  .menu-open .mhb i:nth-child(3) { transform: translateY(-6.75px) rotate(-45deg); }
}

/* ---------- Phone menu sheet ---------- */
.mov { display: none; }
@media (max-width: 600px) {
  html.menu-open { overflow: hidden; }
  .mov {
    position: fixed; inset: 0; z-index: 55; background: #FAF3E1;
    display: flex; flex-direction: column; box-sizing: border-box; padding: 96px 22px 28px;
    transform: translateY(100%); visibility: hidden;
    transition: transform .45s cubic-bezier(.2,.8,.2,1), visibility 0s linear .45s;
  }
  .menu-open .mov { transform: none; visibility: visible; transition: transform .45s cubic-bezier(.2,.8,.2,1), visibility 0s; }
  .mov ul { list-style: none; margin: 20px 0 0; padding: 0; position: relative; height: 380px; }
  .mov li { position: absolute; }
  .mlk { display: inline-block; background: #000; color: #FAF3E1; font-size: 34px; font-weight: 700; letter-spacing: 1px; padding: 12px 22px; border: 1.5px solid #000; border-radius: 3px; white-space: nowrap; transition: background-color .2s, color .2s; }
  .mlk:hover { background: #FAF3E1; color: #000; text-decoration: none; }
  .mfoot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; border-top: 1.5px solid #000; padding-top: 20px; font-size: 14px; }
  .mmail { padding: 10px 16px; border: 1.5px dashed #000; font-weight: 700; }
  .mmail:hover { background: #000; color: #FAF3E1; text-decoration: none; }
  .menu-open .mst { animation: mst-in .4s ease-out both; }
  .menu-open .mst:nth-child(1) { animation-delay: .18s; }
  .menu-open .mst:nth-child(2) { animation-delay: .24s; }
  .menu-open .mst:nth-child(3) { animation-delay: .30s; }
  .menu-open .mfoot { animation-delay: .36s; }
}
@keyframes mst-in { 0% { opacity: 0; } 100% { opacity: 1; } }

/* ---------- Footer ---------- */
.foot {
  height: 140px; box-sizing: border-box; margin: 0 var(--pad); border-top: 1.5px solid #000;
  display: flex; justify-content: space-between; align-items: center; font-size: 20px;
}
.foot p { margin: 0; }
.foot a { padding: 10px 18px; border: 1.5px dashed #000; font-weight: 700; }
.foot a:hover { background: #000; color: #FAF3E1; text-decoration: none; }
@media (max-width: 1024px) {
  .foot { height: 120px; font-size: 18px; }
  .foot a { padding: 10px 16px; }
}
@media (max-width: 600px) {
  .foot { height: 96px; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caret::after { animation: none; }
  .mov, .menu-open .mov, .mhb, .mhb i { transition: none !important; }
  .menu-open .mst { animation: none; }
}

/* ---------- Polaroids: fall in, tape sticks (Home and About) ---------- */
.pol-a { transform-origin: 50% 0; animation: pol-fall 1.4s cubic-bezier(.33,0,.25,1) .6s both; }
.tape-a { animation: tape-stick .5s cubic-bezier(.2,.8,.3,1.2) .15s both; }
.tdrop-a { animation: tape-drop .5s cubic-bezier(.2,.8,.3,1.2) .15s both; }
.pol-wait, .tape-wait { opacity: 0; }
@keyframes pol-fall {
  0% { opacity: 0; transform: perspective(1400px) rotateX(80deg) rotateZ(-8deg); box-shadow: 0 0 0 #000; }
  12% { opacity: 1; }
  45% { transform: perspective(1400px) rotateX(0deg) rotateZ(4deg); }
  60% { transform: perspective(1400px) rotateX(14deg) rotateZ(-3deg); }
  75% { transform: perspective(1400px) rotateX(0deg) rotateZ(1.5deg); box-shadow: calc(10 * var(--k)) calc(10 * var(--k)) 0 #000; }
  87% { transform: perspective(1400px) rotateX(4deg) rotateZ(-0.6deg); }
  100% { opacity: 1; transform: perspective(1400px) rotateX(0deg) rotateZ(0deg); box-shadow: calc(10 * var(--k)) calc(10 * var(--k)) 0 #000; }
}
@keyframes tape-stick {
  0% { opacity: 0; transform: translateY(-40px) rotate(-10deg) scale(1.3); }
  60% { opacity: 1; transform: translateY(3px) rotate(8deg) scale(0.96); }
  100% { opacity: 1; transform: rotate(6deg) scale(1); }
}
@keyframes tape-drop {
  0% { opacity: 0; transform: translateY(-40px) rotate(-14deg) scale(1.3); }
  60% { opacity: 1; transform: translateY(3px) rotate(2deg) scale(0.96); }
  100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pol-a, .tape-a, .tdrop-a { animation: none; }
  .pol-wait, .tape-wait { opacity: 1; }
}

/* ---------- Page transition: ink wipe (0.7s total) ---------- */
/* Cover half: a black panel grows from the left, then the next page loads. */
.wipe {
  position: fixed; inset: 0; z-index: 1000; background: #000; pointer-events: none;
  transform-origin: 0 50%; animation: wipe-cover .35s cubic-bezier(.65,0,.35,1) both;
}
@keyframes wipe-cover { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* Reveal half: the new page starts covered and the panel shrinks off to the right. */
html.wipe-in body::after {
  content: ""; position: fixed; inset: 0; z-index: 1000; background: #000; pointer-events: none;
  transform-origin: 100% 50%; animation: wipe-reveal .35s cubic-bezier(.65,0,.35,1) both;
}
@keyframes wipe-reveal { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
  .wipe, html.wipe-in body::after { display: none; }
}

}
