/* ==========================================================================
   yomiplush.dev — styles
   Sections: tokens · reset · layout · header · projects · repo card · footer
   ========================================================================== */

/* --- tokens --------------------------------------------------------------- */
:root {
  --bg: #08161f;
  --bg-grad: linear-gradient(180deg, #0e2231 0%, #08161f 52%, #02070a 100%);
  --fg: #e6eef3;
  --muted: #8ba0ad;
  --line: #16262f;
  --card: #0d1c25;
  --card-hover: #122530;
  --accent: #d98a5b;
  --cyan: #6fd7ec;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #e9f4fb;
    --bg-grad: linear-gradient(180deg, #f4fafe 0%, #e3eef8 55%, #c6d9e7 100%);
    --fg: #122029;
    --muted: #43596a;
    --line: #cfe2ee;
    --card: #ffffff;
    --card-hover: #f1f9fe;
    --accent: #b5561f;
    --cyan: #076a80;
  }
}

/* --- reset ---------------------------------------------------------------- */
* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: transparent;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; }

a { color: inherit; }

/* focus ring for keyboard users only */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .repo { transition: none; }
}

/* --- layout --------------------------------------------------------------- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 8vh 24px 64px;
}

/* --- header --------------------------------------------------------------- */
.head {
  display: flex;
  align-items: center;
  gap: 18px;
}

.head-text { min-width: 0; }

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.head h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tag {
  margin: 6px 0 0;
  color: var(--muted);
}

.links {
  margin-top: 16px;
  display: flex;
  gap: 18px;
}

.links a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  font-size: 0.95rem;
}

.links a:hover { border-bottom-color: var(--accent); }

/* --- projects ------------------------------------------------------------- */
.projects { margin-top: 60px; }

.projects h2 {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 18px;
}

.repos { display: grid; gap: 10px; }

.loading,
.fallback {
  color: var(--muted);
  font-size: 0.95rem;
}

.fallback a { color: var(--fg); }

/* --- repo card ------------------------------------------------------------ */
.repo {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.repo:hover {
  background: var(--card-hover);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.repo-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.repo-name {
  font-family: var(--mono);
  font-size: 0.98rem;
  font-weight: 600;
}

.repo-fork {
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}

.repo-desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.repo-meta {
  margin-top: 10px;
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--mono);
}

.lang { display: inline-flex; align-items: center; gap: 6px; }

.lang-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

/* --- footer --------------------------------------------------------------- */
/* hidden until .repos is populated so the async list cannot shift the footer */
html:not(.ready) .foot { display: none; }

.foot {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--mono);
}

.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--fg); }
.dot { margin: 0 8px; }

/* --- splash (startup, infosec flavour) ------------------------------------ */
#splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 50;
  transition: opacity 0.4s ease, visibility 0.4s;
}

/* Auto-hide fallback so a no-JS visitor is never trapped on the splash. */
#splash:not(.done) {
  animation: splash-fallback 0.4s ease 2.2s forwards;
}

#splash.done {
  opacity: 0;
  visibility: hidden;
}

@keyframes splash-fallback {
  to { opacity: 0; visibility: hidden; }
}

.splash-box {
  display: grid;
  justify-items: center;
  gap: 14px;
  font-family: var(--mono);
  text-align: center;
}

/* Apple-style smooth arc spinner, in the accent colour. */
.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--cyan) 28%, transparent);
  border-top-color: var(--cyan);
  animation: spinner-spin 0.8s linear infinite;
}

@keyframes spinner-spin {
  to { transform: rotate(360deg); }
}

.splash-log {
  margin: 0;
  color: var(--cyan);
  font-size: 0.92rem;
}

/* terminal caret */
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 3px;
  vertical-align: -0.15em;
  background: var(--cyan);
  animation: caret-blink 1.1s steps(1) infinite;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

.splash-meta {
  margin: 0;
  color: var(--cyan);
  opacity: 0.65;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: spinner-pulse 1.4s ease-in-out infinite; }
  .caret { animation: none; }
}

@keyframes spinner-pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* --- about page ----------------------------------------------------------- */
.about { margin-top: 60px; }

.about h2 {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 18px;
}

.about h2 + p { margin-top: 0; }
.about p { max-width: 60ch; }

.linklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.linklist a { text-decoration: none; border-bottom: 1px solid var(--line); }
.linklist a:hover { border-bottom-color: var(--accent); }

/* --- consent banner ------------------------------------------------------- */
#consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
  transform: translateY(115%);
  transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

#consent[hidden] { display: none; }
#consent.shown { transform: translateY(0); }

.consent-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 14px 20px;
  align-items: center;
  flex-wrap: wrap;
}

.consent-text {
  margin: 0;
  flex: 1 1 320px;
  font-size: 0.88rem;
  color: var(--muted);
}

.consent-text a { color: var(--cyan); }

.consent-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.btn {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.84rem;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}

.btn:hover { border-color: var(--cyan); }
.btn-accept { background: var(--cyan); border-color: var(--cyan); color: var(--bg); }
.btn-accept:hover { opacity: 0.9; }
.btn-ghost { color: var(--muted); }

/* --- long-form document (privacy policy) ---------------------------------- */
.doc { margin-top: 60px; }

.doc h2 {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 18px;
}

.doc h3 {
  font-family: var(--mono);
  font-size: 0.86rem;
  margin: 26px 0 6px;
}

.doc p, .doc li { max-width: 68ch; }
.doc .updated { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; }
.doc code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--card);
  padding: 1px 5px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) { #consent { transition: none; } }

/* --- animated background (PS3-XMB-style wave) ----------------------------- */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* --- personal-site link (About) ------------------------------------------- */
.homelink {
  margin: 22px 0 0;
}

.homelink a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.92rem;
}

.homelink a:hover { border-color: var(--cyan); }
.homelink-emoji { font-size: 1.15rem; line-height: 1; }

/* --- narrow screens ------------------------------------------------------- */
@media (max-width: 520px) {
  main { padding: 6vh 18px 48px; }
  .projects { margin-top: 44px; }
  .avatar { width: 52px; height: 52px; }
}
