/* =========================================================================
   stevenmellett.com
   ========================================================================= */

/* ---- tokens ------------------------------------------------------------ */
:root {
  /* brand */
  --orange:      #f97316;
  --orange-lit:  #fb923c;
  --orange-deep: #c2410c;

  /* surfaces -- light code-editor */
  --bg:          #fbfaf8;
  --bg-tint:     #f2efe9;
  --surface:     #ffffff;
  --border:      rgba(24, 20, 16, .13);
  --border-soft: rgba(24, 20, 16, .07);

  /* ink */
  --text:        #1c1917;
  --text-mid:    #57534e;
  --text-faint:  #8b827a;
  --comment:     #9a9088;

  --glow:        rgba(249, 115, 22, .20);
  --shadow-sm:   0 1px 3px rgba(38, 26, 14, .07);
  --shadow-md:   0 10px 28px -10px rgba(38, 26, 14, .20);
  --shadow-lg:   0 30px 70px -26px rgba(38, 26, 14, .34);

  --radius:      10px;
  --max:         1080px;
  --ease:        cubic-bezier(.22, 1, .36, 1);

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono',
          Menlo, Consolas, 'Liberation Mono', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0c0a09;
    --bg-tint:     #17130f;
    --surface:     #1a1512;
    --border:      rgba(255, 246, 238, .14);
    --border-soft: rgba(255, 246, 238, .07);

    --text:        #f5f0eb;
    --text-mid:    #b0a69d;
    --text-faint:  #7d736b;
    --comment:     #6f665f;

    --glow:        rgba(249, 115, 22, .28);
    --shadow-sm:   0 1px 3px rgba(0, 0, 0, .5);
    --shadow-md:   0 10px 28px -10px rgba(0, 0, 0, .7);
    --shadow-lg:   0 30px 70px -26px rgba(0, 0, 0, .8);
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15.5px;
  font-variant-ligatures: none;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* orange bloom */
body::before {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(36rem 28rem at 74% 6%,  var(--glow), transparent 64%),
    radial-gradient(32rem 26rem at 10% 92%, var(--glow), transparent 60%);
}

/* faint editor grid, faded at the edges */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .55;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 30%, transparent 78%);
}

img { max-width: 100%; height: auto; display: block; }

/* the hidden attribute must always win, even over display:flex classes */
[hidden] { display: none !important; }

a { color: var(--orange-deep); text-underline-offset: 3px; }
@media (prefers-color-scheme: dark) { a { color: var(--orange-lit); } }

:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 4px; }

::selection { background: var(--orange); color: #fff; }

/* syntax-ish accents */
.cmt  { color: var(--comment); }
.hl   { color: var(--orange-deep); }
@media (prefers-color-scheme: dark) { .hl { color: var(--orange-lit); } }

/* ---- motion ------------------------------------------------------------ */
@keyframes rise  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes bloom { from { opacity: 0; transform: scale(.95); }      to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.reveal { opacity: 0; animation: rise .7s var(--ease) forwards; }
.d1 { animation-delay: .05s; }
.d2 { animation-delay: .15s; }
.d3 { animation-delay: .26s; }
.d4 { animation-delay: .38s; }
.d5 { animation-delay: .50s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; }
  .cursor { opacity: 1 !important; }
}

/* ---- header ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.site-header.is-stuck { border-bottom-color: var(--border-soft); }

.header-inner {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .88rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  transition: opacity .2s ease;
}
.brand:hover { opacity: .65; }

.brand-tile {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(145deg, var(--orange-lit), var(--orange-deep));
  box-shadow: 0 2px 8px -2px var(--glow);
  flex: none;
}

/* ---- dropdown ---------------------------------------------------------- */
.dropdown { position: relative; }

.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font: inherit;
  font-size: .84rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, color .2s ease;
}
.dropdown-toggle::before { content: '~/'; color: var(--orange); }
.dropdown-toggle:hover { border-color: var(--orange); color: var(--orange-deep); }
@media (prefers-color-scheme: dark) { .dropdown-toggle:hover { color: var(--orange-lit); } }

.caret { transition: transform .28s var(--ease); opacity: .6; }
.dropdown-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  min-width: 236px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: bloom .22s var(--ease);
}
.dropdown-menu[hidden] { display: none; }

.dropdown-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
  font-size: .85rem;
  transition: background .15s ease, color .15s ease;
}
.dropdown-menu a::before { content: '\2192\00a0'; color: transparent; transition: color .15s ease; }
.dropdown-menu a:hover,
.dropdown-menu a:focus-visible { background: var(--bg-tint); color: var(--orange-deep); }
.dropdown-menu a:hover::before,
.dropdown-menu a:focus-visible::before { color: var(--orange); }
@media (prefers-color-scheme: dark) {
  .dropdown-menu a:hover, .dropdown-menu a:focus-visible { color: var(--orange-lit); }
}

.tag {
  font-size: .66rem;
  letter-spacing: .04em;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
}

.dropdown-sep { height: 1px; margin: 5px 8px; background: var(--border-soft); }

/* ---- hero -------------------------------------------------------------- */
.hero {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(30px, 6vh, 68px) 26px clamp(52px, 8vh, 88px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 28px;
  padding: 5px 13px;
  font-size: .76rem;
  color: var(--text-mid);
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 3px var(--glow);
  flex: none;
}

.greeting {
  margin: 0;
  max-width: 22ch;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.7rem, 5.4vw, 3.4rem);
  line-height: 1.24;
  letter-spacing: -.03em;
}

.greeting .prompt { color: var(--orange); font-weight: 500; }

.cursor {
  display: inline-block;
  width: .56em;
  height: 1em;
  margin-left: .12em;
  vertical-align: -.13em;
  background: var(--orange);
  animation: blink 1.15s steps(1) infinite;
}

.subgreeting {
  margin: 20px 0 0;
  max-width: 62ch;
  font-size: clamp(.84rem, 1.9vw, .95rem);
  line-height: 1.75;
  color: var(--comment);
  text-wrap: balance;
}

/* ---- dog --------------------------------------------------------------- */
.dog {
  position: relative;
  margin: clamp(40px, 6vh, 62px) 0 0;
  animation: bloom .9s var(--ease) .28s both;
}

.dog-frame {
  width: min(300px, 70vw);
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-tint);
  box-shadow: var(--shadow-md);
}

.dog-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@supports not (aspect-ratio: 1) {
  .dog-frame { height: 70vw; max-height: 300px; }
}

.dog figcaption {
  margin-top: 20px;
  font-size: .78rem;
  color: var(--comment);
}

/* ---- buttons ----------------------------------------------------------- */
.actions {
  margin-top: clamp(34px, 5vh, 48px);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: .85rem;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .22s ease,
              border-color .2s ease, color .2s ease;
}
.btn::before { content: '['; color: var(--text-faint); transition: color .2s ease; }
.btn::after  { content: ']'; color: var(--text-faint); transition: color .2s ease; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--orange); }
.btn:hover::before, .btn:hover::after { color: var(--orange); }
.btn:active { transform: translateY(0); }

.btn svg { flex: none; }

.btn-primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(140deg, var(--orange-lit), var(--orange));
  box-shadow: 0 5px 18px -7px var(--glow), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary::before, .btn-primary::after { color: rgba(255,255,255,.6); }
.btn-primary:hover {
  border-color: transparent;
  filter: brightness(1.05);
  box-shadow: 0 10px 26px -9px var(--glow), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover::before, .btn-primary:hover::after { color: #fff; }

.btn-primary .arrow { transition: transform .22s var(--ease); }
.btn-primary:hover .arrow { transform: translateX(3px); }

/* ---- portfolio page ---------------------------------------------------- */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(30px, 5vh, 54px) 26px 68px;
}

.page-head { margin-bottom: 26px; }

.page h1 {
  margin: 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.5rem, 4.4vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: -.03em;
}
.page h1 .prompt { color: var(--orange); font-weight: 500; }

.page .lede {
  margin: 10px 0 0;
  max-width: 62ch;
  font-size: .87rem;
  color: var(--comment);
}

.pdf-frame {
  position: relative;
  width: 100%;
  height: min(78vh, 940px);
  background: var(--bg-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.pdf-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.pdf-fallback { padding: 40px; text-align: center; color: var(--comment); }

.page .actions { justify-content: flex-start; margin-top: 20px; }

/* ---- footer ------------------------------------------------------------ */
.site-footer {
  padding: 24px 26px 32px;
  text-align: center;
  font-size: .76rem;
  color: var(--comment);
  border-top: 1px solid var(--border-soft);
}
.site-footer p { margin: 0; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--orange-deep); }
@media (prefers-color-scheme: dark) { .site-footer a:hover { color: var(--orange-lit); } }

/* ---- small screens ----------------------------------------------------- */
@media (max-width: 560px) {
  body { font-size: 15px; }
  .header-inner { padding: 12px 16px; }
  .hero, .page { padding-left: 18px; padding-right: 18px; }
  .greeting { max-width: 18ch; }
  .actions .btn { flex: 1 1 100%; justify-content: center; }
  .pdf-frame { height: 66vh; }
}
