/*
 * linkprofile "crimson" theme: an obsidian page with scarlet accents, a 46px grid and tactile cards.
 * Inter is (c) The Inter Project Authors and Lexend (c) The Lexend Project Authors, both
 * SIL OFL 1.1 (assets/fonts/OFL-inter.txt, assets/fonts/OFL-lexend.txt).
 */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/inter-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/lexend-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("assets/fonts/lexend-latin-800-normal.woff2") format("woff2");
}

/*
 * Colours. Light is the base; dark (obsidian) applies when the theme option "mode" is "dark"
 * (the default), or "auto" and the system prefers dark. Every tint is mixed from the accent,
 * so the palette sits on body, where the accent is set. Accent-coloured text and icons use
 * --accent-ink: the accent mixed with black (light) or white (dark), so it keeps 4.5:1 or
 * more on the page and the cards for any accent.
 */
body {
  --accent-ink: color-mix(in srgb, var(--accent) 42%, #000000);
  --canvas: #f8fafc;
  --top-glow: color-mix(in srgb, var(--accent) 10%, transparent);
  --glow: color-mix(in srgb, var(--accent) 8%, transparent);
  --grid-line: color-mix(in srgb, var(--accent) 3%, transparent);
  --ring: color-mix(in srgb, var(--accent) 10%, transparent);
  --ring-near: color-mix(in srgb, var(--accent) 4%, transparent);
  --ring-far: color-mix(in srgb, var(--accent) 2%, transparent);
  --card-bg: #ffffff;
  --card-border: rgb(15 23 42 / 0.08);
  --card-shadow: rgb(15 23 42 / 0.08);
  --ink: #0f172a;
  --muted: #64748b;
  --rule: rgb(15 23 42 / 0.08);
  --tile-top: color-mix(in srgb, var(--accent) 12%, #ffffff);
  --tile-bottom: color-mix(in srgb, var(--accent) 22%, #ffffff);
  --tile-border: color-mix(in srgb, var(--accent) 25%, transparent);
  --social-bg: #f8fafc;
  --social-hover: color-mix(in srgb, var(--accent) 12%, #ffffff);
}

:root {
  color-scheme: light;
}

:root[data-mode="dark"] {
  color-scheme: dark;
}

:root[data-mode="auto"] {
  color-scheme: light dark;
}

/* The dark palette: keep in sync with the prefers-color-scheme block below. */
:root[data-mode="dark"] body {
  --accent-ink: color-mix(in srgb, var(--accent) 50%, #ffffff);
  --canvas: #050505;
  --glow: color-mix(in srgb, var(--accent) 18%, transparent);
  --grid-line: rgb(255 255 255 / 0.035);
  --ring: color-mix(in srgb, var(--accent) 14%, transparent);
  --ring-near: rgb(255 255 255 / 0.025);
  --ring-far: color-mix(in srgb, var(--accent) 6%, transparent);
  --card-bg: rgb(18 18 22 / 0.88);
  --card-border: rgb(255 255 255 / 0.09);
  --card-shadow: rgb(0 0 0 / 0.5);
  --ink: #ffffff;
  --muted: #a3a3a3;
  --rule: rgb(255 255 255 / 0.07);
  --tile-top: color-mix(in srgb, var(--accent) 18%, #000000);
  --tile-bottom: color-mix(in srgb, var(--accent) 5%, #000000);
  --tile-border: color-mix(in srgb, var(--accent) 38%, transparent);
  --social-bg: rgb(255 255 255 / 0.04);
  --social-hover: color-mix(in srgb, var(--accent) 20%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root[data-mode="auto"] body {
    --accent-ink: color-mix(in srgb, var(--accent) 50%, #ffffff);
    --canvas: #050505;
    --glow: color-mix(in srgb, var(--accent) 18%, transparent);
    --grid-line: rgb(255 255 255 / 0.035);
    --ring: color-mix(in srgb, var(--accent) 14%, transparent);
    --ring-near: rgb(255 255 255 / 0.025);
    --ring-far: color-mix(in srgb, var(--accent) 6%, transparent);
    --card-bg: rgb(18 18 22 / 0.88);
    --card-border: rgb(255 255 255 / 0.09);
    --card-shadow: rgb(0 0 0 / 0.5);
    --ink: #ffffff;
    --muted: #a3a3a3;
    --rule: rgb(255 255 255 / 0.07);
    --tile-top: color-mix(in srgb, var(--accent) 18%, #000000);
    --tile-bottom: color-mix(in srgb, var(--accent) 5%, #000000);
    --tile-border: color-mix(in srgb, var(--accent) 38%, transparent);
    --social-bg: rgb(255 255 255 / 0.04);
    --social-hover: color-mix(in srgb, var(--accent) 20%, transparent);
  }
}

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--canvas);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/*
 * Decoration: a glow along the top edge, an accent aura behind the header and a 46px grid
 * over the page (body::before), and concentric rings around the header (body::after).
 */
body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
}

body::before {
  inset: 0;
  background:
    linear-gradient(180deg, var(--top-glow), transparent) 0 0 / 100% 160px no-repeat,
    radial-gradient(circle at 50% 28%, var(--glow), transparent 65%),
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px) 0 0 / 46px 46px,
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px) 0 0 / 46px 46px;
}

body::after {
  top: 18%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 580px;
  height: 580px;
  border-radius: 50%;
  border: 1.5px solid var(--ring);
  box-shadow: 0 0 0 65px var(--ring-near), 0 0 0 135px var(--ring-far);
}

.cr-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header card, with an accent line fading in along its top edge */
.cr-hero {
  position: relative;
  padding: 32px;
  border-radius: 28px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 20px 50px var(--card-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}

.cr-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.75;
}

.cr-identity {
  display: flex;
  align-items: center;
  gap: 20px;
}

.cr-avatar {
  display: block;
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  padding: 4px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 60%, transparent), transparent);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 30%, transparent);
}

.cr-identity-text {
  flex: 1;
  min-width: 0;
}

.cr-title {
  margin: 0;
  font-family: "Lexend", ui-sans-serif, system-ui, sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.cr-bio {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .cr-hero {
    padding: 28px 24px;
  }

  .cr-identity {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Socials */
.cr-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.cr-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--social-bg);
  border: 1px solid var(--card-border);
  color: var(--muted);
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.cr-social-btn svg {
  width: 18px;
  height: 18px;
}

.cr-social-btn:hover {
  transform: translateY(-1.5px);
  background: var(--social-hover);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent-ink);
}

/* Links heading: a mono label on a rule */
.cr-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
  margin-top: 8px;
}

.cr-section-label {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.cr-section-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 40%, transparent), var(--card-border) 60%, transparent);
}

/* Link cards */
.cr-links {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cr-link-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 8px 24px var(--card-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.cr-link-card:hover {
  transform: translateY(-2.5px);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 14px 32px -6px color-mix(in srgb, var(--accent) 28%, transparent);
}

.cr-link-card:active {
  transform: translateY(0);
}

.cr-icon-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--tile-top), var(--tile-bottom));
  border: 1px solid var(--tile-border);
  color: var(--accent-ink);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.cr-link-card:hover .cr-icon-tile {
  transform: scale(1.05);
  border-color: var(--accent);
}

.cr-icon-tile svg {
  width: 20px;
  height: 20px;
}

/* A link's own colour fills the tile; on a dark colour (the build works it out) the glyph turns white. */
.is-colored {
  background: var(--link-color);
  border-color: transparent;
  color: #0f172a;
}

.cr-link-card:hover .is-colored {
  border-color: transparent;
}

.ink-light {
  color: #ffffff;
}

.is-image {
  overflow: hidden;
}

.is-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cr-initial {
  font-family: "Lexend", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 800;
}

.cr-link-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cr-link-title {
  font-family: "Lexend", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

.cr-link-card:hover .cr-link-title {
  color: var(--accent-ink);
}

.cr-link-url {
  margin-top: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cr-arrow {
  width: 16px;
  height: 16px;
  margin: 0 6px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.cr-link-card:hover .cr-arrow {
  color: var(--accent-ink);
  transform: translateX(3px);
}

/* Phones: tighter socials and link cards, so five socials fit a row and titles have room */
@media (max-width: 480px) {
  .cr-socials {
    gap: 8px;
  }

  .cr-link-card {
    gap: 12px;
    padding: 14px;
  }

  .cr-arrow {
    margin: 0;
  }
}

/* Focus */
a:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .cr-social-btn,
  .cr-link-card,
  .cr-icon-tile,
  .cr-link-title,
  .cr-arrow {
    transition: none;
  }

  .cr-social-btn:hover,
  .cr-link-card:hover,
  .cr-link-card:active,
  .cr-link-card:hover .cr-icon-tile,
  .cr-link-card:hover .cr-arrow {
    transform: none;
  }
}
