/**
 * ===================================================================
 * MESSAGE - Main Application Stylesheet (v15.1) - Splash Tidy (Safe, Softer)
 * ===================================================================
 */

/* --- Palette Tokens (browns + pale blue) --- */
:root {
  --bg-page: #f5f8fc;           /* softer near-white with a hint of blue */
  --ink: #2f2a26;               /* primary text (deep brown/charcoal) */
  --muted: #6b6056;             /* muted brown text */
  --card: #ffffff;              /* card surface */
  --card-beige: #eadbc8;        /* soft beige for accents */
  --beige-bar: #E6D7C4;         /* MATCHED to image color */
  --accent: #8f6b4a;            /* softened warm brown for buttons */
  --accent-strong: #7a5a3e;     /* hover/darker state */
  --accent-tint: #f3ece5;       /* very light warm tint for hovers */
  --shadow-1: 0 10px 25px -8px rgba(0,0,0,0.25);
  --shadow-2: 0 18px 45px -15px rgba(0,0,0,0.35);
}

/* Global reset helpers */
*, *::before, *::after { box-sizing: border-box; }
img, video { max-width: 100%; height: auto; }

/* Height of the name bar (adjust if you want more/less gap) */
:root { --name-bar-h: 108px; }

/* Bullet-proof header layout */
.card-header { position: relative; height: 50%; }
.hero-image{
  position: absolute;
  top: var(--name-bar-h); left: 0; right: 0; bottom: 0;
  background: url('../suijuris.jpg') center top / cover no-repeat;
}

/* 1. Register the font */
@font-face {
  font-family: 'MyTypewriter';
  src: url('../fonts/typewriter.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
/* Name bar — revert to system font (inherit), bold, large */
.name{
  position: absolute; top: 0; left: 0; width: 100%;
  height: var(--name-bar-h);
  display: flex; align-items: center; /* balanced top/bottom */
  padding: 0 40px;
  background: var(--beige-bar);
  margin: 0;

 font-family: 'MyTypewriter', serif; /* Fallback to serif if font fails */
/*  font-family: 'Besley', serif;*/
  font-size: 3rem;        /* big and clear */
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;      /* no tight tracking */
}

/* Proper superscript “by:” */
.name sup{
  position: relative;
  top: -0.55em;           /* lift it like a true superscript */
  font-size: 0.55em;
  font-weight: 400;
  margin-right: 10px;
  letter-spacing: 0.5px;
}

/* Prevent sideways scroll on narrow screens */
html, body { overflow-x: hidden; }

/* Mobile: scale cleanly, keep spacing comfy */
@media (max-width: 600px) {
  :root { --name-bar-h: 82px; }
  .business-card{
    width: 100%;
    max-width: 100%;
    aspect-ratio: auto;
    height: auto;
    margin: 0 auto;
    border-radius: 10px;
  }
  .card-header{ height: 44vh; }
  .name{
    font-size: clamp(1.8rem, 7vw, 2.3rem);
    padding: 0 20px;
  }
  .name sup{
    top: -0.6em;
    font-size: 0.58em;
  }
}


/* --- Global & Typography (SAFE: no body flex/centering) --- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--ink);
  margin: 0;
  line-height: 1.6;
  padding: 20px;
}

/* --- Business Card (Splash) --- */
.business-card {
  width: min(100%, 900px);
  aspect-ratio: 210 / 148;              /* A5 vibe, responsive */
  background-color: var(--card);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-2), var(--shadow-1);
  margin: 40px auto;                    /* SAFE: center horizontally only */
}


.card-body {
  padding: 22px 40px;
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center; /* SAFE: only within the card */
}

/* Links / CTA on splash */
.links-container { width: auto; }

/* Keep your global .link-item (below) for the app, but style the splash button via .link-button */
.link-button {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--card); /* text becomes light on accent bg */
  background-color: var(--accent);
  border: 1px solid rgba(0,0,0,0.04);
  padding: 12px 18px;
  border-radius: 10px;
  transition: transform 0.04s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 18px rgba(90, 59, 40, 0.18);
}
/* Envelope button text colour matches name bar */
.link-button {
  background-color: var(--beige-bar);
  color: var(--ink); /* dark text on beige background */
}

.link-button:hover {
  background-color: var(--accent-strong);
  color: var(--card); /* white text on hover */
}

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

.link-icon { width: 28px; height: 28px; display: grid; place-items: center; }
/* SVGs on the splash button inherit the link color via currentColor */
.business-card .link-icon svg { display: block; color: currentColor; }

.link-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
  font-family: 'MyTypewriter', serif; /* same as .name */
}

/* Footer */
.card-footer {
  padding: 16px 40px;
  background-color: #E6D7C4;          /* warm tint that pairs with browns */
  border-top: 1px solid rgba(0,0,0,0.06);
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* ===================================================================
   Rest of Application Styles (unchanged behavior)
   =================================================================== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 30px;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.app-logo a { font-size: 1.5em; font-weight: bold; color: #2c3e50; }
.app-nav a { margin: 0 15px; font-size: 1.1em; color: #555; }
.app-nav a.active { font-weight: bold; color: #3498db; }

.app-user-actions .logout-link {
  display: inline-block;
  padding: 5px 12px;
  background-color: #e74c3c;
  color: #fff;
  border-radius: 4px;
  font-size: 0.9em;
  margin-left: 15px;
}
.app-user-actions .logout-link:hover { background-color: #c0392b; text-decoration: none; }

.form-field { margin-bottom: 20px; }
.form-field label { display: block; font-weight: bold; margin-bottom: 8px; }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1em;
}
.form-field textarea { min-height: 150px; resize: vertical; }
.field-description { font-size: 0.9em; color: #666; margin-top: 5px; }

.button, button {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  background-color: #95a5a6;
  color: white;
  font-size: 1em;
  cursor: pointer;
  border-radius: 4px;
  text-align: center;
}
.button-primary, button[type="submit"] { background-color: #3498db; }
.button-primary:hover, button[type="submit"]:hover { background-color: #2980b9; }

.notice {
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.notice.error { background-color: #f2dede; color: #a94442; border-color: #ebccd1; }
.notice.success { background-color: #dff0d8; color: #3c763d; border-color: #d6e9c6; }

.login-container,
.security-gate-container,
.contact-form-container,
.compose-container,
.conversation-container,
.inbox-container {
  background-color: #fff;
  padding: 30px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  width: 100%;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  max-width: 980px;              /* Constrain width so forms don't sprawl */
  margin: 20px auto;             /* Center within page */
}

.login-box, .security-gate-box {
  width: 100%;
  max-width: 400px;
  text-align: center;
  margin: 0 auto;
}
.security-gate-box input[type="text"] {
  text-align: center;
  font-size: 1.5em;
  letter-spacing: 5px;
}

.conversation-container .message-item {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.conversation-container .message-item.latest-message { border-left: 5px solid #3498db; }
.conversation-container .message-meta {
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px dotted #ccc;
  font-size: 0.9em;
  color: #555;
}
.conversation-container .message-subject { font-weight: bold; margin-bottom: 15px; font-size: 1.1em; }
.conversation-container .message-body { white-space: pre-wrap; }
.conversation-container .attachment-link {
  margin-top: 15px;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

.inbox-nav {
  display: flex;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}
.inbox-nav a {
  padding: 15px 20px;
  color: #555;
  font-weight: bold;
}
.inbox-nav a.active,
.inbox-nav a:hover {
  color: #3498db;
  background-color: #fff;
  text-decoration: none;
}

.empty-list-message {
  padding: 40px;
  text-align: center;
  color: #777;
  font-size: 1.2em;
}

.message-item-wrapper {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
}
.message-item-wrapper:last-child { border-bottom: none; }

.message-status-bar { width: 5px; align-self: stretch; flex-shrink: 0; }
.status-sm .message-status-bar { background-color: #2ecc71; }
.status-sr .message-status-bar { background-color: #95a5a6; }
.status-sa .message-status-bar { background-color: #3498db; }
.status-sx .message-status-bar { background-color: #9b59b6; }
.status-sf .message-status-bar { background-color: #7f8c8d; }
.message-item-wrapper.urgent .message-status-bar { background-color: #e74c3c; }

.message-item {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 0;
  margin: 0;
}

.message-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.message-item-header:hover { background-color: #f8f9fa; }

.message-item-content { flex-grow: 1; }

.message-header .sender-name { font-weight: bold; }

.message-count-badge,
.urgent-badge {
  display: inline-block;
  color: #fff;
  font-size: 0.8em;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 10px;
  font-weight: bold;
}
.message-count-badge { background-color: #bdc3c7; }
.urgent-badge { background-color: #e74c3c; }

.message-meta {
  border: none;
  padding: 0;
  margin: 5px 0 0 0;
  font-size: 0.9em;
  color: #777;
}
.ip-address { margin-left: 15px; }

.message-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}
.message-actions .action-btn {
  display: inline-block;
  padding: 5px 12px;
  font-size: 0.9em;
  font-weight: normal;
  line-height: 1.5;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid transparent;
  text-decoration: none;
  color: white;
}
.btn-view { background-color: #1abc9c; }
.btn-urgent { background-color: #f39c12; }
.btn-archive { background-color: #7f8c8d; }
.btn-delete { background-color: #e74c3c; }

.message-item-body {
  background-color: #f8f9fa;
  padding: 20px;
  border-top: 1px solid #e0e0e0;
}

.inline-thread-message {
  padding: 15px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background-color: #fff;
  margin-bottom: 10px;
}
.inline-thread-message:last-child { margin-bottom: 0; }

#form-sending-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.spinner-message {
  padding: 20px 40px;
  background: #2c3e50;
  color: #fff;
  border-radius: 8px;
  font-size: 1.2em;
}

/* Popup Style - Centralized and auto-dismissing */
.popup-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #333;
  color: #fff;
  padding: 20px;
  border-radius: 8px;
  font-size: 16px;
  text-align: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none; /* Prevent interaction while it's hidden */
  transition: opacity 0.3s ease-out;
}

/* Generic link styling used across the app (kept from v14) */
.link-item {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #333;
}
.link-icon { width: 32px; height: 32px; margin-right: 16px; }
/* .link-text (global) already defined above for the splash; keep as-is for consistency */

/* =========================================================
   Mobile refinements (fill viewport and tighten spacing)
   ========================================================= */

/* =========================================================
   MOBILE (<=900px) — smaller name, footer always visible
   ========================================================= */
@media (max-width: 900px) {
  /* No hero on mobile */
  .business-card .card-header .hero-image { display: none !important; }

  /* Card fits the viewport; footer stays in view */
  .business-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 8px auto !important;
    border-radius: 12px !important;

    display: grid !important;
    grid-template-rows: auto 1fr auto !important;  /* header | body | footer */
    max-height: 100svh !important;                 /* mobile-safe viewport */
    max-height: 100dvh !important;                 /* fallback */
    overflow: hidden !important;
  }

  /* Header spacing */
  .business-card .card-header {
    position: relative !important;
    padding: 12px 18px !important;
    height: auto !important;
  }

  /* Name: reduce ~1/3 from earlier */
  .business-card .card-header .name {
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap !important;
    line-height: 1.1 !important;
    font-size: clamp(22px, 5.2vw, 34px) !important; /* was ~8vw → ~5.2vw */
  }
  .business-card .card-header .name sup {
    top: -0.6em !important;
    font-size: 0.58em !important;
  }

  /* Body centered, tighter padding so footer fits */
  .business-card .card-body {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px 18px !important;
  }

  /* Keep button readable but compact */
  .business-card .link-button { padding: 12px 16px !important; }
  .business-card .link-button .link-text { font-size: 16px !important; white-space: nowrap !important; }
  .business-card .link-icon { width: 22px !important; height: 22px !important; }

  /* Footer always in view with comfy padding */
  .business-card .card-footer {
    padding: 12px 18px !important;
    text-align: center !important;
  }
}
/* =========================================================
   MOBILE (<=900px): allow taller card so footer fits
   ========================================================= */
@media (max-width: 900px) {
  /* Keep hero hidden per your compromise */
  .business-card .card-header .hero-image { display: none !important; }

  /* Let the card grow beyond the viewport (scroll instead of clipping) */
  .business-card {
    display: grid !important;
    grid-template-rows: auto 1fr auto !important; /* header | body | footer */
    max-height: none !important;                   /* remove viewport cap */
    overflow: visible !important;                  /* no clipping */
    margin-bottom: 24px !important;                /* breathing room below */
  }

  /* Footer stays readable and not jammed at the bottom */
  .business-card .card-footer {
    position: static !important;
    padding: 14px 20px !important;
    min-height: 48px;                              /* optional, a bit taller */
  }

  /* Optional: small bottom padding so iOS safe area doesn't crowd it */
  body { padding-bottom: 12px; }
}
/* Links: inherit site palette instead of browser blue */
.business-card a,
.law-content a {
  color: var(--ink);            /* same dark text as the rest */
  text-decoration: none;
}
.business-card a:visited,
.law-content a:visited { color: var(--ink); }
.business-card a:hover,
.law-content a:hover { opacity: .85; }

/* Phones/tablets in landscape: show hero like desktop */
@media (max-width: 900px) and (orientation: landscape) {
  :root { --name-bar-h: clamp(56px, 9vw, 72px); } /* reasonable bar height */

  .business-card .card-header {
    position: relative !important;
    padding: 0 18px !important;
    height: min(42vh, 360px) !important;   /* room for name + hero */
  }

  .business-card .card-header .name {
    position: absolute !important;
    top: 0; left: 0; right: 0;
    height: var(--name-bar-h) !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  /* Override the mobile rule that hides it */
  .business-card .card-header .hero-image {
    display: block !important;
    position: absolute;
    top: var(--name-bar-h); left: 0; right: 0; bottom: 0;
    background: url('../suijuris.jpg') center top / cover no-repeat;
  }
}
/* === Contact form: Back (top-centre) + branded Send (bottom) === */
.contact-form-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-form-container .form-topbar {
  text-align: center;
  margin-top: -4px; /* tuck it close to the card edge */
}

.btn-brand,
.contact-form-container button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
  font-family: 'MyTypewriter', serif;     /* match site heading/button style */
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
  background-color: var(--beige-bar);     /* same beige as name bar */
  color: var(--ink);                      /* dark text */
  box-shadow: 0 6px 18px rgba(90, 59, 40, 0.18);
  transition: background-color .2s ease, color .2s ease, transform .04s ease;
  cursor: pointer;
}

.btn-brand:hover,
.contact-form-container button[type="submit"]:hover {
  background-color: var(--accent-strong);
  color: var(--card);                     /* white text on hover */
}

.btn-brand:active,
.contact-form-container button[type="submit"]:active {
  transform: translateY(0);
}

/* Keep the Send button clearly at the bottom of the form block */
.contact-form-container .form-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;                /* or space-between if you add more actions */
}

/* Make all links in the form match palette (no browser blue) */
.contact-form-container a {
  color: var(--ink);
  text-decoration: none;
}
.contact-form-container a:hover { opacity: .85; }

/* Mobile polish */
@media (max-width: 600px) {
  .btn-brand,
  .contact-form-container button[type="submit"] {
    padding: 12px 16px;
    border-radius: 10px;
  }
}

