/* Dozo Delivery Tracking - foundations */

/*
 * Palette aligned to index.html in the landing page root. The delivery
 * pages sit inside that site, so both name the same values.
 */
:root {
  /* ---- Brand ---- */
  --crimson: #740318;
  --crimson-bright: #8b0000;
  --crimson-soft: rgba(116, 3, 24, 0.07);
  --crimson-edge: rgba(116, 3, 24, 0.14);

  /* ---- Neutrals ---- */
  --bg: #F9F5F0;
  --surface: #ffffff;
  --surface-sunk: #faf7f5;
  --ink: #111111;
  --ink-soft: #4a423e;
  --muted: #6b625c;
  --line: rgba(17, 17, 17, 0.10);
  --line-strong: rgba(17, 17, 17, 0.18);

  /* ---- Semantic ---- */
  --danger: #c8352b;
  --danger-bg: #fdf1f0;
  --warn: #9a5f00;
  --warn-bg: #fdf6ea;
  --ok: #10693a;
  --ok-bg: #eef6f1;

  /* ---- Shape ---- */
  --r: 14px;
  --r-lg: 20px;
  --r-sm: 10px;
  --pill: 999px;

  --shadow-xs: 0 1px 2px rgba(20, 16, 14, 0.04);
  --shadow-sm: 0 1px 3px rgba(20, 16, 14, 0.05), 0 6px 16px -10px rgba(20, 16, 14, 0.14);
  --shadow-md: 0 2px 6px rgba(20, 16, 14, 0.05), 0 14px 34px -18px rgba(20, 16, 14, 0.22);

  /* Minimum comfortable target for a thumb, outdoors, in motion. */
  --tap: 48px;

  /* The layout is fluid: content spans the viewport rather than sitting in a */
  --pad: clamp(20px, 4vw, 64px);
  --gap: 20px;

  --font-body: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", sans-serif;
  --font-display: "Clash Display", "Space Grotesk", "Sora", system-ui, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.wrap {
  width: 100%;
  padding-inline: var(--pad);
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--crimson);
  color: #fff;
  padding: 12px 18px;
  border-radius: 0 0 var(--r-sm) 0;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 2px;
}

/*
 * The router focuses main after every render so a screen reader lands on the
 * new view. That is not keyboard focus and must not draw a ring: main spans the
 * viewport, so only the bottom edge lands on screen and reads as a stray rule
 * above the footer.
 *
 * Scoped to elements that cannot be tabbed to, which is exactly the set that is
 * focused by script rather than by a person.
 */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
  outline: none;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  min-height: 66px;
  flex-wrap: wrap;
  padding-block: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}
.brand img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}
.brand-sub {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-nav {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  padding: 9px 15px;
  border-radius: var(--pill);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  transition: background 0.16s ease, color 0.16s ease;
}
.site-nav a:hover {
  background: var(--surface-sunk);
  color: var(--ink);
}
.site-nav a[aria-current="page"] {
  background: var(--crimson-soft);
  color: var(--crimson);
  font-weight: 600;
}

main {
  flex: 1;
  padding-block: 36px 56px;
}

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

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  padding-block: 20px;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
}

/*
 * The legal line and the tagline are one sentence on a wide screen and two
 * lines on a narrow one. The tagline is a block below 480px rather than being
 * allowed to wrap mid phrase, because "Life in Japan. Made / simple." reads
 * like a mistake.
 */
.footer-legal {
  color: var(--muted);
  line-height: 1.5;
}
.footer-tagline {
  color: var(--ink-soft);
  font-weight: 500;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .site-footer .wrap {
    justify-content: center;
    text-align: center;
  }
  .footer-tagline {
    display: block;
  }
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.12;
  color: var(--ink);
}
h1 {
  font-size: clamp(27px, 4vw, 34px);
  margin: 0 0 8px;
}
h2 {
  font-size: 17px;
  margin: 0 0 14px;
  letter-spacing: -0.015em;
}
h3 {
  font-size: 15px;
  margin: 0 0 8px;
}
p {
  margin: 0 0 14px;
}
.lead {
  color: var(--muted);
  font-size: 16px;
  max-width: 60ch;
  margin-bottom: 0;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.94em;
}
a {
  color: var(--crimson);
}

/* --------------------------------------------------------------------------
   Page header, used on every screen for a consistent opening
   -------------------------------------------------------------------------- */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--gap);
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-header .lead {
  margin-top: 4px;
}

.eyebrow {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--crimson);
  margin-bottom: 10px;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border-radius: var(--r);
  padding: 26px 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap);
}
.card:last-child {
  margin-bottom: 0;
}
.card-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 16px;
}
.card-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (max-width: 640px) {
  .card {
    padding: 20px;
  }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--tap);
  padding: 0 24px;
  border: none;
  border-radius: var(--pill);
  background: var(--crimson);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.16s ease, transform 0.12s ease;
}
.btn:hover:not(:disabled) {
  background: var(--crimson-bright);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-sunk);
  color: var(--crimson);
  box-shadow: inset 0 0 0 1px var(--crimson-edge);
}
.btn-block {
  width: 100%;
}
.btn-small {
  min-height: 38px;
  padding: 0 16px;
  font-size: 13.5px;
}
.btn-large {
  min-height: 56px;
  font-size: 16.5px;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field {
  margin-bottom: 20px;
}
.field:last-child {
  margin-bottom: 0;
}
.field label {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 6px;
  color: var(--ink);
}
.field .hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  margin-top: -2px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  /* 16px minimum, or iOS Safari zooms the page on focus. */
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-soft);
}
input::placeholder,
textarea::placeholder {
  color: #b3a9a2;
}

/* ---------------------------------------------------------------------------
   Password field with a reveal toggle

   The button sits inside the field rather than beside it, so the control keeps
   one tap target of its own without the field losing width on a phone. The
   input gets right padding to match, otherwise a long password runs underneath
   the eye.

   The button is --tap wide as well as tall. An icon sized to the glyph is
   accurate with a mouse and a coin toss with a thumb.
--------------------------------------------------------------------------- */
.password-wrap {
  position: relative;
  display: block;
}
.password-wrap input {
  padding-right: calc(var(--tap) + 4px);
}
.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: var(--tap);
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  transition: color 0.16s ease, background 0.16s ease;
}
.password-toggle:hover {
  color: var(--ink);
}
.password-toggle:active {
  background: var(--crimson-soft);
}
.password-toggle:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: -2px;
  color: var(--ink);
}
.password-toggle[aria-pressed="true"] {
  color: var(--crimson);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
  background: var(--danger-bg);
}
/* The hidden attribute must beat any display rule an element carries.
   .field-error declares display:flex, which overrides the browser's own
   [hidden] rule, so an empty error span rendered and showed its "!" bullet
   under the input. Declared once here rather than per component, because the
   next component to set a display and use [hidden] would hit the same thing. */
[hidden] {
  display: none !important;
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--danger);
  font-size: 13px;
  margin-top: 7px;
  font-weight: 600;
}
.field-error::before {
  content: "!";
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  line-height: 15px;
  text-align: center;
  font-weight: 700;
}

/* Summary shown at the top of a form when a submission is rejected. The
   individual messages still appear against their own fields; this repeats the
   headline so a long form does not look as though nothing happened. */
.form-error {
  border-radius: var(--r-sm);
  padding: 13px 16px;
  margin-bottom: 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 26%, transparent);
}

/* --------------------------------------------------------------------------
   Notices
   -------------------------------------------------------------------------- */

.notice {
  border-radius: var(--r-sm);
  padding: 15px 18px;
  margin-bottom: var(--gap);
  font-size: 14.5px;
  line-height: 1.55;
}
.notice-error {
  background: var(--danger-bg);
  color: #8f231b;
}
.notice-warn {
  background: var(--warn-bg);
  color: #7a4b00;
}
.notice-ok {
  background: var(--ok-bg);
  color: #0c4c2a;
}

/* --------------------------------------------------------------------------
   Tracking number
   -------------------------------------------------------------------------- */

.tracking-number {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
  word-break: break-all;
  margin: 0;
}

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

.state {
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.state h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.stack > * + * {
  margin-top: var(--gap);
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--crimson-soft);
  color: var(--crimson);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: var(--pill);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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