/* @font-face rules now live in fonts.css (served standalone so K-Toyz/K-Watch
   can link it directly instead of duplicating font files) — see base.html/login.html */

/* Ocean & Sun tokens — copied from k-platform/design/tokens.css, re-sync manually */
:root {
  --bg:    #0d2233;
  --dark:  #07121e;
  --s1:    #122d42;
  --s2:    #1a3f57;
  --s3:    #1f4d6e;
  --acc:   #e8c84a;
  --text:  #f5eecc;
  --t2:    #9ac5d5;
  --t3:    #5a8fa0;
  --green: #6dbf8a;
  --blue:  #5bb8d9;
  --red:   #e07070;
  --border: rgba(255, 255, 255, 0.07);
  --r-content: 8px;
  --r-interactive: 999px;
  --r-circle: 50%;

  /* Type scale — was documented on /design but never actually defined as
     real custom properties here; header/footer font-sizes were hardcoded
     rem approximations instead of using it. Now real. */
  --fs-2xs:  9px;
  --fs-xs:  11px;
  --fs-sm:  13px;
  --fs-md:  16px;
  --fs-lg:  20px;
  --fs-xl:  24px;
  --fs-2xl: 30px;
  --fs-3xl: 36px;
}

/* Breakpoint: 680px, shared convention (see design/tokens.css for the full
   note) — CSS vars don't work inside @media, so this is a documented
   literal value, reused as @media (min-width: 680px) wherever needed. */

* { box-sizing: border-box; }

a { text-decoration: none; color: inherit; }

body {
  font-family: 'Barlow', system-ui, sans-serif;
  background: var(--dark);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
}

.login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-brand {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.4rem;
  margin: 0 0 0.5rem;
  text-align: center;
}

.login-card input {
  background: var(--s2);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--r-content);
  font-family: inherit;
  font-size: 0.95rem;
}

.login-card input::placeholder {
  color: var(--t3);
}

.login-card button {
  background: var(--acc);
  color: var(--dark);
  border: none;
  border-radius: var(--r-interactive);
  padding: 0.65rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
  cursor: pointer;
}

.login-card button:hover {
  opacity: 0.9;
}

.error-msg {
  color: var(--red);
  font-size: 0.85rem;
  margin: 0;
}

/* ── Shared header — logo only (no app name; that only ever appears in
   <title>), app-specific nav on the right. Full-width band, inner content
   constrained to match the content area below. Never sticky/fixed — normal
   document flow, scrolls away with the page. See
   docs/downstream-integration.md §7 for the contract other apps copy. ── */
.k-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.k-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 13px 1.5rem 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.k-header-logo { width: 30px; height: 30px; flex-shrink: 0; display: block; }
.k-header-logo img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.k-header-nav {
  display: flex;
  gap: 22px;
}
.k-header-nav a { font-size: var(--fs-sm); color: var(--t2); font-weight: 500; text-decoration: none; }
.k-header-nav a.active { color: var(--text); font-weight: 700; }
.k-header-nav a:hover { color: var(--text); }

main { max-width: 960px; margin: 0 auto; padding: 0 1.5rem 3rem; }

/* ── Shared footer — app-owned nav + core injected by static/js/footer.js.
   See docs/downstream-integration.md §6 for the contract other apps copy. ── */
.k-footer {
  border-top: 1px solid var(--border);
  max-width: 960px;
  margin: 0 auto;
  padding: 36px 1.5rem 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
@media (min-width: 680px) {
  .k-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-top: 26px;
  }
}
.k-footer-app-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
@media (min-width: 680px) {
  .k-footer-app-nav { align-items: flex-start; }
}
.footer-nav-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 28px; }
@media (min-width: 680px) {
  .footer-nav-row { justify-content: flex-start; }
}
.footer-nav-row a { font-size: var(--fs-sm); color: var(--t2); font-weight: 500; text-decoration: none; }
.footer-nav-row a:hover { color: var(--text); }

.k-footer-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
@media (min-width: 680px) {
  .k-footer-core { flex-direction: row; align-items: center; gap: 28px; }
}
.footer-app-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 28px; }
@media (min-width: 680px) {
  .footer-app-links { justify-content: flex-start; }
}
.footer-app-links a { font-size: var(--fs-sm); color: var(--t2); font-weight: 500; text-decoration: none; }
.footer-app-links a.current { color: var(--t3); font-weight: 500; }
.footer-app-links a:hover { color: var(--text); }

.footer-signout {
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  padding: 0;
  padding-top: 20px;
  color: var(--t2);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
@media (min-width: 680px) {
  .footer-signout {
    border-top: none;
    border-left: 1px solid var(--border);
    padding-top: 0;
    padding-left: 24px;
  }
}
.footer-signout:hover { color: var(--red); }

/* ── Hub ── */
.hub-wrap { padding-top: 1.5rem; }
.hub-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  margin: 0 0 1.25rem;
}

/* Compact icon-grid, capped so tiles never stretch to fill the container —
   as many 120-150px columns as fit, same size on mobile and desktop. */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 150px));
  gap: 1rem;
}

.hub-tile {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  color: inherit;
}
.hub-tile-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-content);
  border: 1px solid var(--border);
  background: var(--s1);
  transition: transform 0.15s, border-color 0.15s;
}
.hub-tile:hover .hub-tile-img { border-color: var(--acc); transform: translateY(-2px); }
.hub-tile-desc { font-size: 0.85rem; color: var(--t3); padding: 0 0.1rem; }

/* Design tile has no artwork yet — plain card matching the tile's footprint. */
.hub-tile-plain {
  aspect-ratio: 1;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r-content);
  transition: border-color 0.15s, background 0.15s;
}
.hub-tile-plain:hover { border-color: var(--acc); background: var(--s2); }
.hub-tile-plain-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--acc);
}
.hub-tile-plain .hub-tile-desc { padding: 0 1.5rem; text-align: center; }

/* ── Design page ── */
.design-intro { padding: 2rem 0 1rem; }
.design-intro p {
  max-width: 56ch;
  color: var(--t2);
  font-size: 0.95rem;
  margin: 0.5rem 0 0;
}
.design-block { margin: 2.5rem 0; }
.design-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.design-block-head h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0;
}
.design-block-note {
  font-size: 0.75rem;
  color: var(--t3);
  text-align: right;
  max-width: 34ch;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}
.swatch {
  border-radius: var(--r-content);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--s1);
}
.swatch-fill { height: 68px; position: relative; }
.swatch-fill .hex {
  position: absolute;
  bottom: 6px; left: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(7, 18, 30, 0.55);
}
.swatch-meta { padding: 8px 10px 10px; }
.swatch-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  display: block;
}
.swatch-role { font-size: 0.68rem; color: var(--t3); display: block; margin-top: 1px; }
.swatch-token {
  font-size: 0.68rem;
  color: var(--t3);
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  display: block;
  margin-top: 4px;
}

.type-row {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.type-row:last-child { border-bottom: none; }
.type-tag {
  flex-shrink: 0;
  width: 92px;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 0.65rem;
  color: var(--t3);
}
.type-sample-display { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; }
.type-sample-body { font-family: 'Barlow', sans-serif; font-weight: 500; }

.token-strip { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.token-item { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.token-box { background: var(--s2); border: 1px solid var(--border); }
.token-label {
  font-size: 0.65rem;
  color: var(--t3);
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  text-align: center;
}

/* Breakpoint ruler — 680px marker on a 0-1200px scale (680/1200 = 56.7%) */
.bp-ruler-track {
  position: relative;
  height: 10px;
  border-radius: var(--r-interactive);
  background: var(--s2);
  overflow: visible;
  margin: 28px 0 10px;
}
.bp-ruler-fill {
  position: absolute;
  inset: 0;
  width: 56.7%;
  border-radius: var(--r-interactive) 0 0 var(--r-interactive);
  background: var(--s3);
}
.bp-ruler-marker {
  position: absolute;
  left: 56.7%;
  top: -18px;
  bottom: -18px;
  width: 2px;
  background: var(--acc);
}
.bp-ruler-marker span {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--acc);
  white-space: nowrap;
}
.bp-ruler-zones {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (min-width: 680px) {
  .bp-ruler-zones { flex-direction: row; }
}
.bp-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--t2);
}
.bp-zone strong { color: var(--text); font-size: 0.85rem; }
.bp-zone code { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 0.78rem; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.gcard { background: var(--s1); border: 1px solid var(--border); border-radius: var(--r-content); padding: 18px; }
.gcard-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
  margin: 0 0 14px;
}
.row-flex { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn-primary {
  background: var(--acc); color: var(--dark);
  border-radius: var(--r-interactive);
  padding: 10px 20px;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 0.85rem;
  letter-spacing: 0.04em; border: none; cursor: pointer;
}
.btn-ghost {
  background: transparent; color: var(--t2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-interactive);
  padding: 9px 18px;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 0.85rem;
  letter-spacing: 0.04em; cursor: pointer;
}
.pill {
  font-size: 0.65rem; font-weight: 700;
  padding: 3px 10px; border-radius: var(--r-interactive);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.pill-ordered   { background: rgba(91, 184, 217, 0.85);  color: var(--dark); }
.pill-delivered { background: rgba(232, 200, 74, 0.85);  color: var(--dark); }
.pill-opened    { background: rgba(109, 191, 138, 0.85); color: var(--dark); }

.chip {
  font-size: 0.75rem; font-weight: 600;
  padding: 4px 12px; border-radius: var(--r-interactive);
  border: 1px solid transparent;
}
.chip-all       { background: var(--acc); color: var(--dark); }
.chip-ordered   { background: rgba(91, 184, 217, 0.12); color: var(--blue);  border-color: rgba(91, 184, 217, 0.25); }
.chip-delivered { background: rgba(232, 200, 74, 0.12); color: var(--acc);   border-color: rgba(232, 200, 74, 0.25); }
.chip-opened    { background: rgba(109, 191, 138, 0.12);color: var(--green); border-color: rgba(109, 191, 138, 0.25); }

.field { background: var(--s2); border-radius: var(--r-content); padding: 8px 11px; min-width: 120px; }
.field-label {
  font-size: 0.65rem; color: var(--t3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px;
}
.field-value { font-size: 0.85rem; color: var(--text); }

.demo-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: var(--r-content);
  background: var(--bg); border: 1px solid var(--border);
}
.demo-nav .demo-brand { display: flex; align-items: center; gap: 8px; font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 0.85rem; }
.demo-nav .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--acc); }
.demo-nav .links { display: flex; gap: 14px; font-size: 0.85rem; color: var(--t2); }
.demo-nav .links .active { color: var(--text); font-weight: 700; }

.qlist { display: flex; flex-direction: column; gap: 0.75rem; }
.qitem {
  display: flex; gap: 12px;
  padding: 14px 16px;
  background: var(--s1);
  border-left: 3px solid var(--acc);
  border-radius: 0 var(--r-content) var(--r-content) 0;
}
.qitem .qnum {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; color: var(--acc);
  font-size: 1rem; flex-shrink: 0; width: 20px;
}
.qitem p { margin: 0; font-size: 0.85rem; color: var(--t2); }
.qitem p strong { color: var(--text); }
