/* ============================================================
   Randosell.jp — Global Stylesheet
   2000s Japanese commercial web aesthetic
   Mobile-first, light theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@300;400;500;700&family=Zen+Kaku+Gothic+New:wght@300;400;500;700&display=swap');

/* ── Variables ────────────────────────────────────────────── */
:root {
  /* Palette */
  --red:         #C8402A;
  --red-dark:    #A33220;
  --red-light:   #F2E8E6;
  --red-pale:    #FBF4F3;
  --charcoal:    #2C2C2C;
  --mid:         #666660;
  --light:       #AAAAAA;
  --rule:        #DDDDD8;
  --bg:          #FAFAF7;
  --surface:     #FFFFFF;
  --surface-alt: #F5F5F1;

  /* Typography */
  --font-display: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic Pro', sans-serif;
  --font-body:    'Zen Kaku Gothic New', 'Hiragino Kaku Gothic Pro', sans-serif;
  --font-mono:    'Courier New', monospace;

  /* Spacing */
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap-md: 16px;
  --gap-lg: 24px;
  --gap-xl: 40px;

  /* Borders */
  --border:      1px solid var(--rule);
  --border-red:  1px solid var(--red);
  --border-mid:  1px solid #C8C8C4;
  --radius:      2px;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--charcoal);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mid);
  font-weight: 500;
}

.eyebrow-jp {
  font-size: 11px;
  color: var(--mid);
  letter-spacing: 0.1em;
}

/* ── Layout ───────────────────────────────────────────────── */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--gap-lg) var(--gap-md);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-wide {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--gap-lg) var(--gap-md);
}

/* ── Site header ──────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: var(--gap-md) 0;
  border-bottom: 2px solid var(--red);
  margin-bottom: var(--gap-lg);
}

.site-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.site-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--red);
  letter-spacing: -0.01em;
}

.site-name small {
  font-size: 0.6em;
  color: var(--mid);
  font-weight: 400;
  margin-left: 2px;
  letter-spacing: 0.05em;
}

/* ── Panels / Boxes ───────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: var(--border);
  padding: var(--gap-lg);
  position: relative;
}

.panel + .panel { margin-top: var(--gap-md); }

.panel-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: var(--gap-md);
  padding-bottom: var(--gap-sm);
  border-bottom: var(--border-red);
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.panel-title::before {
  content: '◆';
  font-size: 7px;
  color: var(--red);
}

/* ── Form elements ────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
  margin-bottom: var(--gap-md);
}

.field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--mid);
  letter-spacing: 0.1em;
}

.field-hint {
  font-size: 10px;
  color: var(--light);
  margin-top: var(--gap-xs);
}

input[type="email"],
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: var(--border-mid);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--charcoal);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-light);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 12px var(--gap-md);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
  -webkit-appearance: none;
}

.btn-primary {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

.btn-primary:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
}

.btn-outline {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}

.btn-outline:hover {
  background: var(--red-pale);
}

.btn-ghost {
  background: transparent;
  color: var(--mid);
  border-color: var(--rule);
}

.btn-ghost:hover {
  border-color: var(--mid);
  color: var(--charcoal);
}

.btn + .btn { margin-top: var(--gap-sm); }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 10px var(--gap-md);
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: var(--gap-md);
  display: flex;
  gap: var(--gap-sm);
  align-items: flex-start;
}

.alert::before { flex-shrink: 0; margin-top: 1px; }

.alert-error {
  background: #FEF2F0;
  border: 1px solid #F4C5BE;
  color: #A33220;
}
.alert-error::before { content: '✕'; }

.alert-success {
  background: #F0F7F0;
  border: 1px solid #B8D8B8;
  color: #2D6A2D;
}
.alert-success::before { content: '✓'; }

.alert-info {
  background: #EEF4FF;
  border: 1px solid #B8CEF0;
  color: #1A4A8A;
}
.alert-info::before { content: '✉'; }

/* ── Nav / home button ────────────────────────────────────── */
.home-btn {
  position: fixed;
  bottom: var(--gap-md);
  left: var(--gap-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: opacity 0.15s;
  z-index: 100;
}

.home-btn:hover { opacity: 0.6; }

/* ── Lang toggle ──────────────────────────────────────────── */
.lang-toggle {
  display: flex;
  gap: 2px;
  align-items: center;
  margin-left: auto;
}

.lang-btn {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 7px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
  color: var(--light);
  background: transparent;
  font-family: var(--font-body);
  transition: all 0.15s;
  text-decoration: none;
}

.lang-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.lang-btn:hover:not(.active) {
  border-color: var(--mid);
  color: var(--mid);
}

/* ── Card cover ───────────────────────────────────────────── */
.cover-wrap {
  width: 100%;
  aspect-ratio: 1417/2154;
  background: var(--surface-alt);
  border: var(--border);
  overflow: hidden;
  position: relative;
}

.cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s;
}

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--red);
  margin-bottom: var(--gap-lg);
  gap: 2px;
}

.tab {
  padding: 8px var(--gap-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--mid);
  background: var(--surface-alt);
  border: var(--border-mid);
  border-bottom: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s;
  border-radius: 2px 2px 0 0;
  letter-spacing: 0.05em;
}

.tab.active {
  background: var(--surface);
  color: var(--red);
  border-color: var(--red);
  border-bottom-color: var(--surface);
  margin-bottom: -2px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  margin: var(--gap-md) 0;
  font-size: 11px;
  color: var(--light);
  letter-spacing: 0.1em;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* ── Footer ───────────────────────────────────────────────── */
.page-footer {
  margin-top: auto;
  padding-top: var(--gap-lg);
  border-top: var(--border);
  font-size: 11px;
  color: var(--light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-md);
}

.page-footer a {
  color: var(--mid);
  text-decoration: none;
  transition: color 0.15s;
}

.page-footer a:hover { color: var(--red); }

/* ── Stat rows ────────────────────────────────────────────── */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: var(--border);
  font-size: 13px;
}

.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--mid); }
.stat-value { font-family: var(--font-mono); font-size: 12px; }

/* ── Grid (collection) ────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--gap-md);
}

.grid-item {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.grid-item-cover {
  aspect-ratio: 1417/2154;
  background: var(--surface-alt);
  border: var(--border);
  overflow: hidden;
  margin-bottom: var(--gap-sm);
  transition: border-color 0.15s;
  position: relative;
}

.grid-item:hover .grid-item-cover { border-color: var(--red); }

.grid-item-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.grid-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--charcoal);
  line-height: 1.3;
  margin-bottom: 2px;
}

.grid-item-meta {
  font-size: 10px;
  color: var(--light);
  font-family: var(--font-mono);
}

/* ── User card ────────────────────────────────────────────── */
.user-card {
  background: var(--red-pale);
  border: var(--border-red);
  border-radius: var(--radius);
  padding: var(--gap-md);
  margin-bottom: var(--gap-md);
}

.user-card-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 2px;
}

.user-card-email {
  font-size: 11px;
  color: var(--mid);
}

/* ── Badge / tags ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
}

.badge-red { background: var(--red); color: white; }
.badge-outline { border: var(--border-red); color: var(--red); }
.badge-test { background: #E8F4E8; border: 1px solid #A8CCA8; color: #3A6A3A; }

/* ── Spinner ──────────────────────────────────────────────── */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 0.8s linear infinite; }

/* ── Responsive ───────────────────────────────────────────── */
@media (min-width: 600px) {
  .page { padding: var(--gap-xl) var(--gap-lg); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (min-width: 900px) {
  html { font-size: 15px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
