/* Nifty Services portal — plain CSS, mobile first.
   Brand from new.nifty.services: coral #FA6559, red #FE3628, slate #1E293B, light #F9FAFB, Montserrat
   headings. The coral is too light for white text, so buttons use coral with slate text and links use
   a deeper coral. Change colours here in :root. Fonts are self-hosted in public/fonts. */

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --bg: #F9FAFB;
  --surface: #FFFFFF;
  --text: #1E293B;         /* slate */
  --muted: #475569;
  --line: #E2E8F0;
  --coral: #FA6559;        /* brand coral: backgrounds with slate text (4.9:1) */
  --coral-hover: #FB8278;   /* lighter on hover keeps slate text readable (5.8:1) */
  --accent: #C8372B;       /* deeper coral for links and text on white (5.2:1) */
  --focus: #1E293B;
  --error: #B42318;
  --radius: 12px;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

h1, h2 { font-family: var(--display); font-weight: 700; line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.4rem); }
h2 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
a:hover { color: var(--text); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.skip-link { position: absolute; left: 1rem; top: -4rem; background: var(--text); color: #fff; padding: 0.5rem 1rem; border-radius: 8px; z-index: 10; }
.skip-link:focus { top: 1rem; color: #fff; }

.container { width: 100%; max-width: 60rem; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 30rem; }
.main { padding-top: 2rem; padding-bottom: 3rem; min-height: 60vh; }
.lead { font-size: 1.15rem; }
.muted { color: var(--muted); }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; min-height: 4rem; padding-block: 0.5rem; }
.wordmark { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.2rem; color: var(--text); letter-spacing: -0.01em; }
.wordmark__dot { color: var(--coral); }
.badge { line-height: 1.5; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; background: var(--text); color: #fff; padding: 0.15rem 0.5rem; border-radius: 999px; }
.area-admin .site-header { background: var(--text); }
.area-admin .wordmark { color: #fff; }
.area-admin .badge { background: var(--coral); color: var(--text); }
.area-admin .site-header .link-button { color: #fff; }

/* Buttons and forms */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0.7rem 1.4rem; border: 0; border-radius: 999px;
  background: var(--coral); color: var(--text); font: inherit; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--coral-hover); color: var(--text); }
.link-button { background: none; border: 0; padding: 0.5rem 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

.form { margin-top: 1.5rem; }
.field { margin-bottom: 1.25rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.field input {
  width: 100%; min-height: 48px; padding: 0.65rem 0.85rem;
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid #8A949E; border-radius: 8px;
}
.field input[aria-invalid="true"] { border-color: var(--error); }
.field-error { color: var(--error); font-size: 0.95rem; margin: 0.35rem 0 0; }

/* Cards and stats */
.cards { display: grid; gap: 1rem; margin-top: 1.5rem; }
@media (min-width: 48rem) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.card p:last-child { margin-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin: 1.5rem 0; }
@media (min-width: 48rem) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; }
.stat__value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat__label { color: var(--muted); font-size: 0.95rem; }

.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0; color: var(--muted); font-size: 0.9rem; }

/* Navigation */
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1rem; }
.site-nav a { font-weight: 600; text-decoration: none; }
.area-admin .site-nav a { color: #fff; }
.area-admin .site-nav a:hover { color: var(--coral); }

/* Page parts */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.small { font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.95rem; margin: -0.2rem 0 0.4rem; }
.notice { background: #ECFDF3; border: 1px solid #A6E3BF; border-radius: 8px; padding: 0.75rem 1rem; }
.notice--error { background: #FEF3F2; border-color: #F5B5AF; color: var(--error); }
.button--secondary { background: var(--surface); border: 2px solid var(--text); }
.button--secondary:hover { background: var(--bg); }
.card + .card, .site-card { margin-top: 1rem; }

.list { list-style: none; padding: 0; margin: 1rem 0; }
.list__item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin-bottom: 0.5rem; }
.list__title { font-weight: 700; }
.tag { font-size: 0.8rem; font-weight: 700; border-radius: 999px; padding: 0.1rem 0.6rem; }
.tag--warn { background: #FEF0C7; color: #7A2E0E; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0 0 1.5rem; }
.details dt { font-weight: 600; }
.details dd { margin: 0; overflow-wrap: anywhere; }

/* Maintenance switch */
.switch { border-left: 4px solid var(--line); padding-left: 1rem; }
.switch--on { border-left-color: #F79009; }
.switch__form { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 0.75rem 0; }

.setup summary { cursor: pointer; list-style: revert; }
.setup summary h2 { display: inline; }
.code { background: var(--text); color: #fff; padding: 0.75rem 1rem; border-radius: 8px; overflow-x: auto; font-size: 0.9rem; }

/* Website studio */
textarea { width: 100%; padding: 0.65rem 0.85rem; font: inherit; color: var(--text); background: var(--surface); border: 1px solid #8A949E; border-radius: 8px; resize: vertical; }
textarea[aria-invalid="true"] { border-color: var(--error); }
.undo { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.conversation { list-style: none; padding: 0; margin: 1rem 0 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.bubble { max-width: 40rem; padding: 0.8rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere; }
.bubble--you { align-self: flex-end; background: #FFF1EF; border-color: #FBD0CB; }
.bubble__who { display: block; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.25rem; }
.bubble--working { color: var(--muted); }
.tag--starting, .tag--working { background: #E0EAFF; color: #1E3A8A; }
.tag--replied, .tag--needs_review { background: #FEF0C7; color: #7A2E0E; }
.tag--on_preview { background: #DCFAE6; color: #085D3A; }
.tag--nothing { background: var(--line); color: var(--text); }
.tag--failed { background: #FEE4E2; color: #912018; }
.admin-only { margin-top: 2rem; }
.button-row { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; }
.card + h2 { margin-top: 2rem; }

/* Links that leave the portal open in a new tab; the arrow says so. */
a[target="_blank"]::after { content: "\2009\2197"; font-size: 0.85em; text-decoration: none; display: inline-block; }
a.button[target="_blank"]::after { content: none; }

/* Site status */
.status-list { display: grid; grid-template-columns: 1fr; gap: 0.2rem 1rem; margin: 0; }
@media (min-width: 36rem) { .status-list { grid-template-columns: max-content 1fr; } }
.status-list dt { font-weight: 700; margin-top: 0.6rem; }
@media (min-width: 36rem) { .status-list dt { margin-top: 0; } }
.status-list dd { margin: 0 0 0.4rem; display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; align-items: baseline; }
.state { font-weight: 700; }
.state::before { content: ""; display: inline-block; width: 0.6em; height: 0.6em; border-radius: 50%; margin-right: 0.4em; background: currentColor; }
.state--good { color: #067647; }
.state--warn { color: #B54708; }
.state--bad { color: var(--error); }
.state--neutral { color: var(--muted); }

/* View as client (admin) */
.view-as-banner { background: #FEF0C7; border-bottom: 1px solid #F7C948; color: #7A2E0E; padding: 0.75rem 0; font-size: 0.95rem; }
.view-as-banner a { color: #7A2E0E; font-weight: 700; }
fieldset.view-as { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.view-as :disabled { opacity: 0.55; cursor: not-allowed; }
.tag--undone { background: var(--line); color: var(--text); }
.undo-change { margin: 1rem 0; }

/* Beta copy of the portal (PORTAL_BETA=true) */
.beta-banner { background: repeating-linear-gradient(135deg, #5B21B6 0 18px, #6D28D9 18px 36px); color: #fff; padding: 0.5rem 0; font-size: 0.95rem; text-align: center; }
.beta-banner strong { letter-spacing: 0.08em; }

/* Images (media library) */
.tag--waiting { background: #E0EAFF; color: #1E3A8A; }
.field select { width: 100%; min-height: 48px; padding: 0.65rem 0.85rem; font: inherit; color: var(--text); background: var(--surface); border: 1px solid #8A949E; border-radius: 8px; }
.field input[type="file"] { padding: 0.5rem; }
.check { display: flex; gap: 0.65rem; align-items: flex-start; margin: 0 0 0.85rem; font-weight: 400; }
.check input { width: 1.3rem; height: 1.3rem; min-height: 0; margin-top: 0.15rem; flex: none; accent-color: var(--text); }
.media-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); margin: 1.5rem 0; padding: 0; list-style: none; }
.media-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.media-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #F4F4F5; }
.media-card__body { padding: 0.85rem 1rem 1rem; }
.media-card__name { font-weight: 700; margin: 0 0 0.25rem; }
.media-card__body p { margin: 0 0 0.35rem; font-size: 0.95rem; }
.source-list { padding-left: 1.2rem; }
.source-list li { margin-bottom: 0.35rem; }

/* Site check (admin site page) */
.site-check__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.site-check__head h2 { margin: 0; }
.site-check__where { font-size: 1rem; margin: 1.25rem 0 0.4rem; }
.site-check__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.finding { padding: 0.5rem 0.75rem; border-radius: 8px; border-left: 4px solid var(--line); background: var(--bg); font-size: 0.95rem; }
.finding__level { font-weight: 700; margin-right: 0.35rem; }
.finding--problem { border-left-color: #D92D20; background: #FEF3F2; }
.finding--warning { border-left-color: #F79009; background: #FFFAEB; }
.finding--ok { border-left-color: #12B76A; background: #ECFDF3; }
.finding--info { border-left-color: #2E90FA; background: #EFF8FF; }

/* Help: how to ask for changes */
.tips { padding-left: 1.2rem; margin: 0; }
.tips li { margin-bottom: 0.6rem; }
.examples { display: grid; gap: 1rem; margin: 1rem 0 1.5rem; }
@media (min-width: 48rem) { .examples { grid-template-columns: 1fr 1fr; } }
.example { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.example p { margin: 0 0 0.6rem; }
.example__label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 0.2rem !important; }
.example__label--no { color: var(--muted); }
.example__label--yes { color: #085D3A; }

/* Set-up steps (admin) */
.setup-steps { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: 1rem; }
.setup-step { border-left: 5px solid var(--line); }
.setup-step--pass { border-left-color: #12B76A; }
.setup-step--fail { border-left-color: #D92D20; }
.setup-step--warn { border-left-color: #F79009; }
.setup-step__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.setup-step__head h2 { margin: 0; font-size: 1.15rem; }
.setup-step__result { font-weight: 600; }
.tag--setup-pass { background: #DCFAE6; color: #085D3A; }
.tag--setup-fail { background: #FEE4E2; color: #912018; }
.tag--setup-warn { background: #FEF0C7; color: #7A2E0E; }
.tag--setup-todo { background: var(--line); color: var(--text); }
.setup-step pre.code, pre.code { white-space: pre-wrap; word-break: break-all; }

.media-card__manage { margin-top: 0.5rem; border-top: 1px solid var(--line); padding-top: 0.5rem; }
.media-card__manage summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; }
.media-card__form { margin-top: 0.75rem; }
.media-card__form label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }
.media-card__form .check { font-weight: 400; }
.media-card__row { display: flex; gap: 0.5rem; }
.media-card__row input { flex: 1; min-width: 0; min-height: 44px; padding: 0.4rem 0.6rem; font: inherit; border: 1px solid #8A949E; border-radius: 8px; }

/* Admin error details (resources/views/errors/admin.blade.php) */
.error-details {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f6f6f4;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
    user-select: all;
}

/* A group of choices inside a form (e.g. the image credit question) */
fieldset.field { border: 0; margin: 0 0 1.25rem; padding: 0; min-width: 0; }
fieldset.field legend { font-weight: 600; padding: 0; margin-bottom: 0.25rem; }
fieldset.field .check { margin: 0.35rem 0; }

/* Image credit problems found before publishing */
.credit-problems ul { margin: 0.5rem 0 1rem; padding-left: 1.25rem; }

/* "Fetch the photo" from a free image site */
.fetch-photo { margin-bottom: 0.75rem; }
.import-preview { display: block; max-width: 100%; width: 320px; height: auto; border-radius: 8px; margin: 0.5rem 0; }

/* Find a photo */
.find-form__row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.find-form__row input { flex: 1 1 14rem; }
.photo-results { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.photo-result { background: #fff; border: 1px solid #e3e3e0; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.photo-result img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #f3f3f1; }
.photo-result__credit { margin: 0.5rem 0.75rem; }
.photo-result .button { margin: auto 0.75rem 0.75rem; align-self: flex-start; }
.button--small { padding: 0.4rem 0.9rem; font-size: 0.9rem; }
.studio-find { margin: 0.75rem 0 0; }

/* Hosting (20i) panel */
.hosting .cert { display: block; }

/* Plan and billing */
.plan-card h3 { margin-top: 0; }
.plan-card__price { font-size: 1.25rem; font-weight: 600; }

/* Set-up file status */
.badge--ok { background: #1e7a46; color: #fff; }
.badge--bad { background: #b42318; color: #fff; }
.area-admin .badge--ok { background: #1e7a46; color: #fff; }
.area-admin .badge--bad { background: #b42318; color: #fff; }
.setup summary { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.setup summary h2 { margin: 0; }
.secret-status { list-style: none; padding: 0; margin: 1rem 0; }
.secret-status li { margin: 0.4rem 0; }
