/* --------------------------------------------------------------------------
   kidtag.me design system
   --------------------------------------------------------------------------
   Two surfaces, one brand. The scan page is read by a stranger holding
   someone else's child, outdoors, one-handed: big targets, high contrast, no
   decoration that delays the phone number. The parent portal is a logged-in
   tool and gets a calmer, denser layout.

   Colours are declared once here as custom properties. Nothing below should
   hard-code a hex value that is already a token.
*/

:root {
  color-scheme: light;

  /* Brand */
  --brand-500: #0e9384;
  --brand-600: #0b7a6e;
  --brand-700: #075e55;
  --brand-050: #e6f6f3;
  --accent: var(--brand-600);

  /* Ink */
  --ink: #0f1f2e;
  --ink-soft: #33495d;
  --muted: #5e7284;

  /* Surfaces */
  --surface: #ffffff;
  --surface-sunken: #f1f5f7;
  --line: #dde5ea;
  --line-soft: #e9eff3;

  /* Status */
  --danger: #b4291f;
  --danger-050: #fdeceb;
  /* Some methods got through and some didn't. */
  --warn: #a76a00;

  /* Elevation. Two layers so cards read as lifted, not outlined. */
  --shadow-sm: 0 1px 2px rgba(15, 31, 46, .06), 0 1px 3px rgba(15, 31, 46, .08);
  --shadow-md: 0 2px 4px rgba(15, 31, 46, .05), 0 12px 28px -12px rgba(15, 31, 46, .22);
  --shadow-cta: 0 1px 2px rgba(7, 94, 85, .25), 0 8px 18px -8px rgba(7, 94, 85, .55);

  --radius: 14px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 1.5rem 1rem 3rem;
  font: 17px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background-color: var(--surface-sunken);
  /* A single soft brand wash behind the card. Fixed so it doesn't band on
     scroll, and cheap enough not to delay first paint. */
  background-image:
    radial-gradient(60rem 28rem at 50% -8rem, rgba(14, 147, 132, .18), transparent 70%),
    radial-gradient(40rem 22rem at 85% 0, rgba(14, 116, 144, .12), transparent 65%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 .5rem; }
p { margin: 0 0 1rem; }

a { color: var(--brand-700); }

:focus-visible {
  outline: 3px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --- Brand lockup ------------------------------------------------------- */

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* The lockups are fixed-ratio artwork, so only the height is set and the
   width follows. Anything narrower than a small phone scales down with it. */
.brand img,
.portal-brand img {
  display: block;
  height: 2.5rem;
  width: auto;
  max-width: 100%;
}

/* Scan-page masthead: the brand sits above the card, never competing with
   the child's name inside it. */
.masthead {
  max-width: 34rem;
  margin: 0 auto 1rem;
  display: flex;
  justify-content: center;
}

.site-footer {
  max-width: 34rem;
  margin: 1.25rem auto 0;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
}

.site-footer a { color: inherit; text-decoration: none; }

/* --- Scan card ---------------------------------------------------------- */

.card {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.lead { font-size: 1.2rem; color: var(--ink-soft); }
.notes {
  color: var(--ink-soft);
  background: var(--surface-sunken);
  border-left: 3px solid var(--brand-500);
  border-radius: 0 10px 10px 0;
  padding: .75rem .9rem;
  font-size: .98rem;
}

hr { border: 0; border-top: 1px solid var(--line-soft); margin: 1.75rem 0; }

/* --- Call buttons ------------------------------------------------------- */
/* The first contact is the loudest thing on the page by design; the rest are
   the same size but quieter, so a finder in a hurry has one obvious target. */

.call {
  position: relative;
  display: block;
  margin: 0 0 .7rem;
  padding: 1rem 1rem 1rem 3.25rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-weight: 650;
  font-size: 1.05rem;
  text-align: left;
  text-decoration: none;
  box-shadow: var(--shadow-cta);
}

.call::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 1.4rem;
  height: 1.4rem;
  transform: translateY(-50%);
  background: currentColor;
  /* Handset glyph, masked so it always matches the button's text colour. */
  -webkit-mask: var(--icon-phone) center / contain no-repeat;
  mask: var(--icon-phone) center / contain no-repeat;
}

:root {
  --icon-phone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2a1 1 0 0 1 1-.24c1.1.37 2.3.57 3.5.57a1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.2.2 2.4.57 3.5a1 1 0 0 1-.25 1Z'/%3E%3C/svg%3E");
}

.call span { display: block; font-weight: 400; font-size: .95rem; opacity: .9; }
.call .inline { display: inline; font-weight: inherit; font-size: inherit; opacity: 1; }

.call.secondary {
  background: var(--surface);
  color: var(--brand-700);
  border: 2px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.call.secondary span { color: var(--muted); opacity: 1; }

.call:active { transform: translateY(1px); }

/* --- Buttons ------------------------------------------------------------ */

button {
  width: 100%;
  padding: .95rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

button:hover { background: #1b3147; }
button:disabled { opacity: .5; cursor: default; box-shadow: none; }

#status {
  min-height: 1.5rem;
  margin: .75rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: .95rem;
}

code {
  word-break: break-all;
  font-size: .9em;
  background: var(--surface-sunken);
  padding: .1rem .3rem;
  border-radius: 5px;
}

/* --- Language switcher -------------------------------------------------- */

.languages {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: center;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
}

.languages a {
  padding: .35rem .7rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: .9rem;
  text-decoration: none;
}

.languages a:hover { background: var(--surface-sunken); color: var(--ink); }

.languages a[aria-current] {
  background: var(--brand-050);
  color: var(--brand-700);
  font-weight: 650;
}

/* --- Home page ---------------------------------------------------------- */
/* The sign-in link is deliberately quieter than .call: a finder's first
   action should always be the phone number, never the parent login. */

.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0 0 1.25rem;
}

.steps li {
  position: relative;
  counter-increment: step;
  padding-left: 2.5rem;
  margin-bottom: .85rem;
  color: var(--ink-soft);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -.1rem;
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-050);
  color: var(--brand-700);
  font-size: .9rem;
  font-weight: 700;
}

.parents {
  margin-top: 1.75rem;
  padding: 1.25rem;
  background: var(--surface-sunken);
  border-radius: var(--radius);
}

.parents h2 { margin-top: 0; }
.parents p:last-child { margin-bottom: 0; }

a.button {
  display: inline-block;
  padding: .7rem 1.25rem;
  border: 2px solid var(--brand-600);
  border-radius: var(--radius);
  color: var(--brand-700);
  background: var(--surface);
  font-weight: 650;
  text-decoration: none;
}

a.button:hover { background: var(--brand-050); }

/* --------------------------------------------------------------------------
   Parent portal
   --------------------------------------------------------------------------
   The scan page is a single centred card for a stranger in a hurry. The
   portal is a logged-in tool, so it gets a plain full-width layout instead.
*/

body.portal {
  display: block;
  padding: 0 0 3rem;
  background-image: none;
  background-color: var(--surface-sunken);
}

.portal-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: inherit;
}

.portal-brand img { height: 1.9rem; }

.portal-label {
  padding: .15rem .5rem;
  border-radius: 999px;
  background: var(--brand-050);
  color: var(--brand-700);
  font-size: .75rem;
  font-weight: 650;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.portal-bar nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: .95rem;
}

.portal-bar nav a { color: var(--ink-soft); text-decoration: none; font-weight: 550; }
.portal-bar nav a:hover { color: var(--brand-700); }

.portal-main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}

.portal-main section {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-width: 28rem;
}

.stack button {
  margin-top: .75rem;
  align-self: flex-start;
  width: auto;
  padding: .7rem 1.4rem;
}

.stack label {
  font-weight: 650;
  font-size: .9rem;
}

.stack input,
.stack select,
.stack textarea {
  padding: .6rem .7rem;
  border: 1px solid #c3ced7;
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
}

.stack input:focus,
.stack select:focus,
.stack textarea:focus {
  border-color: var(--brand-500);
  outline: 2px solid rgba(14, 147, 132, .25);
  outline-offset: 0;
}

form.inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  margin-top: .4rem;
}

form.inline button {
  width: auto;
  padding: .45rem .9rem;
  font-size: .9rem;
}

.cards,
.log {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.cards li,
.log li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.log li.status-failed {
  border-left: 4px solid var(--danger);
}

.log li.status-partial {
  border-left: 4px solid var(--warn);
}

/* One line per delivery method, so a failed text is visible next to the
   portal copy that obviously arrived. */
.deliveries {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0;
  font-size: .9rem;
  color: var(--muted);
}

.deliveries li.status-failed {
  color: var(--danger);
}

.deliveries .channel {
  font-weight: 600;
}

.log time {
  display: block;
  font-size: .85rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: .9rem;
}

.tag-link {
  display: block;
  margin-top: .2rem;
  color: var(--brand-700);
  font-size: .9rem;
  word-break: break-all;
}

.tag-qr {
  display: block;
  margin-bottom: .5rem;
  background: #fff;
}

.error { color: var(--danger); }

.flashes {
  list-style: none;
  padding: .7rem 1rem;
  margin: 0 0 1.25rem;
  background: var(--brand-050);
  border: 1px solid #bfe3dc;
  border-left: 4px solid var(--brand-500);
  border-radius: 10px;
  color: var(--brand-700);
}

.linklike {
  width: auto;
  background: none;
  border: none;
  padding: 0;
  color: var(--brand-700);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  box-shadow: none;
}

.linklike:hover { background: none; color: var(--brand-500); }

.check {
  display: inline-flex;
  gap: .3rem;
  align-items: center;
  font-size: .9rem;
}

/* Sign-in sits on the public side of the portal, so it gets the scan page's
   centred card treatment rather than the full-width tool layout. */
.portal-main .auth-card {
  max-width: 24rem;
  margin: 2rem auto;
  padding: 1.75rem 1.5rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.portal-main .auth-card .stack { max-width: none; }
.portal-main .auth-card .stack button { align-self: stretch; width: 100%; }

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