/* Copyright 2024-2027 Sovereign. All rights reserved. */

/* ==========================================================================
   Sovereign website. Same design system as the launcher
   (Sovereign/src/styles/global/tokens.css + components.css, Classic theme).
   Token names and values are copied 1:1; only the type scale is larger,
   because a web page is read at arm's length in a full browser window,
   not in a 1225px launcher window.
   ========================================================================== */

@font-face { font-family: "Poppins"; font-weight: 400; font-style: normal; font-display: swap; src: url("/assets/fonts/Poppins-Regular.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 400; font-style: italic; font-display: swap; src: url("/assets/fonts/Poppins-Italic.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-style: normal; font-display: swap; src: url("/assets/fonts/Poppins-Medium.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-style: normal; font-display: swap; src: url("/assets/fonts/Poppins-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-style: normal; font-display: swap; src: url("/assets/fonts/Poppins-Bold.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 800; font-style: normal; font-display: swap; src: url("/assets/fonts/Poppins-ExtraBold.ttf") format("truetype"); }

:root {
  /* Launcher tokens (Classic theme), unchanged. */
  --accent: #FFBA49;
  --gold: #FFBA49;
  --gold-light: color-mix(in srgb, var(--gold) 40%, #ffffff);
  --gold-gradient: linear-gradient(90deg, var(--gold-light) 0%, var(--gold) 130%);
  --btn-primary: radial-gradient(circle, #FFBA49 0%, #FFBA49 0%, #C5B59A 135%, #C5B59A 0%);
  --surface: radial-gradient(circle at 55% 99%, #00000009 25%, rgba(255, 255, 255, 0.35) 500%);
  --theme-ground: linear-gradient(to right, #0B0E12, #191D23);

  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-active: rgba(255, 255, 255, 0.35);
  --ring: inset 0 0 0 1.5px var(--border);
  --ring-hover: inset 0 0 0 2px var(--border-hover);

  --text-muted: rgba(255, 255, 255, 0.55);
  --text-soft: rgba(255, 255, 255, 0.8);

  --radius: 8px;
  --radius-sm: 6px;
  --radius-container: calc(var(--radius) + 12px);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  --dur-hover: 350ms;
  --dur-state: 300ms;
  --ease-out: cubic-bezier(0.2, 0.9, 0.05, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-hover: box-shadow var(--dur-hover) var(--ease-smooth), opacity var(--dur-hover) var(--ease-smooth), background var(--dur-hover) var(--ease-smooth);
  /* Site only: text links also fade their colour. */
  --transition-link: var(--transition-hover), color var(--dur-hover) var(--ease-smooth);

  /* Web layout. */
  --page-width: 1180px;
  --header-height: 64px;

  color-scheme: dark;
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  color: #ffffff;
  background-color: #0B0E12;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

/* Continuous corners, exactly as the launcher does it. */
@supports (corner-shape: squircle) {
  :root { --radius: 12px; --radius-sm: 9px; }
  *, *::before, *::after { corner-shape: squircle; }
}

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

html { scroll-padding-top: calc(var(--header-height) + var(--space-6)); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--theme-ground) fixed;
}

h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; text-decoration: none; font-weight: 500; }
img { display: block; max-width: 100%; }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: var(--space-2); left: var(--space-2); z-index: 200;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius);
  background: var(--surface), var(--theme-ground); box-shadow: var(--ring);
  font-size: 12px; font-weight: 600;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.container {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ---------- Header (the launcher's title bar, as a site bar) ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(11, 14, 18, 0.72);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: inset 0 -1.5px 0 var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  font-weight: 600;
}

.brand img { width: 18px; height: 18px; }

.site-nav { display: flex; align-items: center; gap: var(--space-1); }

.site-nav a {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition-link);
}

/* One hover everywhere: the launcher's 2px inset ring. */
.site-nav a:hover { color: #ffffff; box-shadow: var(--ring-hover); }

/* Active item: the launcher drawer's selected item (surface + hairline). */
.site-nav a[aria-current="page"] {
  color: #ffffff;
  background: var(--surface);
  box-shadow: var(--ring);
}

.site-header-actions { display: flex; align-items: center; gap: var(--space-2); margin-inline-start: auto; }

/* ---------- Buttons: launcher .btn, 1:1 ---------- */

.btn {
  all: unset;
  corner-shape: squircle;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  box-sizing: border-box;
  border-radius: var(--radius);
  box-shadow: var(--ring);
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
  color: #ffffff;
  white-space: nowrap;
  cursor: pointer;
  transition: box-shadow var(--dur-hover) var(--ease-smooth), opacity var(--dur-hover) var(--ease-smooth);
}

.btn:hover { box-shadow: var(--ring-hover); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--primary { background: var(--btn-primary); }
.btn--neutral { background: var(--surface); }
.btn--block { display: flex; width: 100%; }
.btn svg { width: 14px; height: 14px; flex: none; }

/* ---------- Text helpers ---------- */

.widget-text,
.text-gold {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.widget-text { font-size: 12px; font-weight: 600; }

.page-title { font-size: 32px; line-height: 1.2; font-weight: 600; }
.page-subtitle { font-size: 14px; line-height: 1.6; color: var(--text-muted); max-width: 560px; }

.hori-line {
  border: none;
  margin: 0;
  min-height: 1.5px;
  height: 1.5px;
  width: 100%;
  flex-shrink: 0;
  background-color: var(--border);
}

/* ---------- News tags: the launcher's gradient text, not pills ---------- */

.news-meta { display: flex; align-items: center; gap: var(--space-2); line-height: 1; }

.news-tag {
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.news-tag--update { background-image: var(--gold-gradient); }
.news-tag--event { background-image: linear-gradient(90deg, #FF7A00, #ffa958); }
.news-tag--patch { background-image: linear-gradient(90deg, #FFFFFF 0%, #7ED1FF 130%); }

.news-date { font-size: 12px; font-weight: 500; color: var(--text-muted); }

/* ---------- Surfaces ---------- */

.card {
  border-radius: var(--radius-container);
  background: var(--surface);
  box-shadow: var(--ring);
}

/* Every picture in a frame: no text is ever written on a picture. */
.picture {
  position: relative;
  overflow: hidden;
  background: var(--surface);
}

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

.picture::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--ring);
  pointer-events: none;
}

/* ==========================================================================
   News. Only what the launcher ships (Sovereign/src/widgets/NewsWidget.tsx,
   NewsPostModal.tsx, styles/pages/Home.css): the split card, the
   "More updates" list rows and the pop-up. Web sizes, launcher shapes:
   launcher 16 / 14 / 12 / 10 px text = 22 / 20 / 15 / 12 px here.
   ========================================================================== */

.page { flex: 1; padding: var(--space-12) 0 var(--space-12); }

.page-head { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-6); }

/* .home-news-row */
.news-row { display: flex; gap: var(--space-4); width: 100%; align-items: stretch; }

/* .home-news-card: picture left, text right, nothing on the picture. */
.news-card {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 360px;
  border-radius: var(--radius-container);
  background: var(--surface);
  overflow: hidden;
}

/* 16:9 alone; square beside the "More updates" list, as in the launcher. */
.news-card-picture { flex: 0 0 auto; height: 100%; aspect-ratio: 16 / 9; background: none; }
.news-card--beside-list .news-card-picture { aspect-ratio: 1 / 1; }
.news-card-picture::after { box-shadow: none; }

.news-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
  padding: var(--space-6);
}

.news-card-title { font-size: 22px; line-height: 1.3; font-weight: 600; }

.news-card-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  overflow: hidden;
  max-width: 520px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-soft);
}

.news-card-button { flex: none; margin-top: auto; }

/* .home-news-list */
.news-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 360px;
  min-width: 360px;
  height: 360px;
  padding: var(--space-4);
  border-radius: var(--radius-container);
  background: var(--surface);
  box-shadow: var(--ring);
}

.news-list-header { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.news-list-header .widget-text { margin: 0; }

/* .home-shop-time-box */
.count-box {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 26px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--ring);
  font-size: 10px;
  font-weight: 500;
}

.count-box svg { width: 10px; height: 10px; }

.news-list-items { display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: var(--space-3); flex: 1; min-height: 0; }

/* .home-news-item: thumb, title, tag + date. */
.news-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  min-width: 0;
  min-height: 0;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.news-item-thumb { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 4px; background: none; }

.news-item-info { display: flex; flex-direction: column; justify-content: center; gap: var(--space-2); min-width: 0; }

.news-item-title {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-item-meta { display: flex; align-items: center; gap: var(--space-2); line-height: 1; }
.news-item-meta .news-tag { font-size: 12px; }
.news-item-meta .news-date { font-size: 12px; font-weight: 400; color: #ffffff; opacity: 0.55; }

/* Older posts: the same rows, under the launcher's line + section title. */
.news-older { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-8); }
.news-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-3); }
.news-items .news-item { height: 72px; }

/* The launcher draws its hairline and hover ring as an inset shadow; here it
   sits above the picture so the hover shows on every edge. */
.news-card,
.news-item { position: relative; }

.news-card::after,
.news-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  box-shadow: var(--ring);
  pointer-events: none;
  transition: var(--transition-hover);
}

.news-card:hover::after,
.news-item:hover::after { box-shadow: var(--ring-hover); }

/* The card or row is one link; the title's link stretches over it. */
.stretch-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.stretch-link:focus-visible { outline: none; }
.stretch:has(.stretch-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.section-title { margin: 0; font-size: 12px; font-weight: 600; color: #ffffff; }

/* ---------- States ---------- */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

.state img { width: 40px; height: 40px; opacity: 0.25; }
.state strong { color: #ffffff; font-weight: 600; font-size: 16px; }

.skeleton {
  border-radius: var(--radius-container);
  background: var(--surface);
  box-shadow: var(--ring);
  position: relative;
  overflow: hidden;
}

.skeleton::before {
  content: "";
  position: absolute;
  inset: 0;
  /* The launcher's skeleton sheen (styles/global/utilities.css), value for value. */
  background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, 0.07) 50%, transparent 75%);
  transform: translateX(-100%);
  animation: skeleton-sheen 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
}

@keyframes skeleton-sheen { to { transform: translateX(100%); } }

.skeleton--card { flex: 1; height: 360px; }
.skeleton--list { width: 360px; height: 360px; }

/* ---------- The pop-up as a page ---------- */

.post-container { max-width: calc(800px + 2 * var(--space-6)); }

.article-top { display: flex; margin-bottom: var(--space-6); }

/* .modal-panel.news-post-modal: theme ground + surface, the stronger hairline. */
.post-sheet {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-container);
  background: var(--surface), var(--theme-ground);
  box-shadow: inset 0 0 0 1.5px var(--border-hover);
}

/* .modal-header: tag + date left, the actions right; it stays in view while reading. */
.post-sheet-header {
  position: sticky;
  top: var(--header-height);
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  min-height: 30px;
  /* Inside the panel's padding, so the panel's hairline is never covered. */
  margin-top: calc(-1 * var(--space-2));
  padding: var(--space-2) 0 var(--space-2) 4px;
  background: var(--theme-ground);
}

.post-actions { display: flex; gap: var(--space-2); }
.post-actions[hidden] { display: none; }

/* .news-post-website: the header's 30px control. */
.btn--sm { height: 30px; padding: 0 var(--space-3); border-radius: var(--radius-sm); }

.open-hint { margin-top: calc(-1 * var(--space-2)); font-size: 12px; line-height: 1.6; color: var(--text-muted); }
.open-hint a { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; }
.open-hint[hidden] { display: none; }

/* .news-post-hero: the picture alone, with the hairline. */
.hero { height: clamp(220px, 32vw, 400px); border-radius: var(--radius); }

/* .news-post-article */
.article { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; padding: 0 var(--space-1) var(--space-3); }

.article-intro { display: flex; flex-direction: column; gap: var(--space-2); }
.article-title { font-size: 28px; line-height: 1.25; font-weight: 600; }
/* The summary is body-sized, so the title is the only headline (the pop-up's rule). */
.article-lead { max-width: 720px; font-size: 15px; line-height: 1.6; color: var(--text-soft); }

.article-section { display: flex; flex-direction: column; gap: var(--space-2); }
.article-heading { font-size: 20px; line-height: 1.3; font-weight: 600; }
.article-subheading { margin-top: var(--space-2); font-size: 15px; line-height: 1.3; font-weight: 600; }

.article-text,
.article-list { max-width: 720px; font-size: 15px; line-height: 1.6; color: var(--text-soft); }

.article-list { margin: 0; padding-inline-start: 22px; }
.article-list li::marker { color: var(--text-muted); }

/* .news-post-note: surface + hairline, no accent. */
.article-note {
  max-width: 720px;
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--ring);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-soft);
}

.news-text-bold { font-weight: 600; color: #ffffff; }
.news-text-italic { font-style: italic; }
.news-text-underline { text-decoration: underline; }
.news-text-strike { text-decoration: line-through; }
.news-text-underline.news-text-strike { text-decoration: underline line-through; }

.more-news { margin-top: var(--space-8); display: flex; flex-direction: column; gap: var(--space-3); }
.more-news[hidden] { display: none; }

/* ---------- Footer ---------- */

.site-footer { box-shadow: inset 0 1.5px 0 var(--border); padding: var(--space-6) 0; }

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.site-footer nav { display: flex; gap: var(--space-4); }
.site-footer a { transition: var(--transition-link); }
.site-footer a:hover { color: #ffffff; }

/* ---------- Small screens: the row stacks, the card stacks ---------- */

@media (max-width: 960px) {
  .news-row { flex-direction: column; }
  .news-list, .skeleton--list { width: 100%; min-width: 0; height: auto; }
  .news-list-items { grid-template-rows: none; }
  .news-list .news-item { height: 72px; }
}

@media (max-width: 720px) {
  .news-card { flex-direction: column; height: auto; }
  .news-card-picture,
  .news-card--beside-list .news-card-picture { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .news-card-body { padding: var(--space-4); }
}

@media (max-width: 640px) {
  .container { padding: 0 var(--space-4); }
  .page { padding: var(--space-6) 0 var(--space-12); }
  .site-nav { display: none; }
  .page-title { font-size: 26px; }
  .article-title { font-size: 24px; }
  .news-card-title { font-size: 20px; }
  .hero { height: auto; aspect-ratio: 16 / 9; }
  .news-items { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
